Wednesday, May 19, 2010

Putting Apache 2 In Front for YSLOW, Load Balancing, and Sub-domains



For my experimental website, http://comparexy.com, I was able to get by just dandy using a Tomcat server as the front-end for CompareXY, but I have a couple of other objectives in mind.
  1. Load balancing, not so much because I need to do this, but because configuring the site to be enabled for load balancing will simplify scaling in the future in case I really need it.
  2. Multiple domains / applications running on the server
    • I may split up some tasks into different application.
    • I want a static content domain up there *
      • This will host static content for my site such as CSS, Scripts, Images, and other artifacts.
      • As per the suggestions of YSLOW (based upon Yahoo's performance guidelines) and Google's Page Speed I will:
        • a) Use a static content domain to be as a cookie-free domain (results in less network overhead)
        • b) Set the headers to have a far ahead expiration date (causes caches to last longer, though you I will need to change the name of the content with a version number to force updates to work)
      • This should help me score higher on the YSLOW grading chart if I move the static content to the sub-domain.

        Happily, I was able to get my YSLOW score up to a B. Not good enough yet, but an improvement:
        YSLOW Report
  3. Also, when I kill my Tomcat server between reloading new versions of the WAR, I would prefer that the site serves a maintenance page to anyone that attempts to connect to my site during the brief downtime, rather just not connecting. I can enable this by adding a “maintenance” site to Apache, that performs a catch-all on requests..
* Though, truly, a domain for static content is probably wholly unnecessary for a low volume web application as mine. This is a good example of Misapplication of a Best Practice on my part :), as I'm not serving millions of people, and no one visitor is likely to have a better experience based upon this. Regardless, this site is largely a vehicle for self-instruction.

Go here to see the rest of the details and instructions


No comments:

Post a Comment