Wayne State Web Team

Wayne State University Web Team Blog

Optimizing high traffic pages with web standards

The first days of a semester are always big for students and for hits to the Wayne State Homepage (opens new window). 40,500 visitors the first day and 36,500 the second.

We are lucky in the fact that our hosting environment is setup to regularly respond to this amount of bandwidth. That is not to say we don't have to optimize the site, far from the truth. The inherited version of the homepage weighed in at 400k total, 25k just for the HTML and over 40 http requests, it was a bad situation.

Recently we moved the homepage to the main server and rebuilt the site from scratch. Giving us ~120k total weight, 6k in HTML and just 15 http requests (including google analytics). Making this optimization didn't happen over night, it took some time to get the numbers down this low, here is what we did.

  1. Scrapped the original table based layout for CSS and XHTML. _This took the site down by 70% right off the bat.

    _

  2. Optimized all images and combined where necessary. _Removed ~10 http requests and saved 50% in file size.

    _

  3. Used Yahoo's YSlow rules to have a goal to reach. We knew it was not possible to get an "A" grade since we do not have a CDN but we did our best in all other categories.[

    ](http://blogs.wayne.edu/web/files/2008/01/picture-1.png "YSlow wayne.edu")

  4. Combined and Minified all Javascript and CSS. _Saved ~5 http requests and 40% in file size.

    _

  5. Configured far future expire tags and ETags. Making a second visitor with primed cache only need to grab ~50kb and 2-3 http request depending on the rotating panel.

Back end changes helped a lot on the server load also. A few things helped the processing time for each http request.

  1. Removed all DB connections. _All the dynamic data is updated via a cron with static html, this reduced the impact on the server per page load dramatically.

    _

  2. Reduced the number of PHP includes. _Combined as many files as possible and used full paths for includes to reduce the number of files the server has to access per page load.

    _

  3. Took the homepage out of a php framework and wrote custom functions. Further reducing the overhead of the page load to just the essentials.

Overall we have had great response from the decreased load times and the standardization of the page. Response time during high traffic times like the start of classes and early registration have been kept so low it has eliminated any complaints we received in the past about slow page loading.

It took about 2 months to get everything in place and tested but it was well worth it. We have a standard compliant site now with very little impact on the server environment. Keeping it simple, flawless and eliminating any wasteful overhead definitely attributed to the projects success.