Friday, March 7th, 2008
Steve Souders, the Web performance chap, has been inspired to calculate how green your website is based on the correlation between fast pages and energy:
Intrigued by an article on Radar about co2stats.com, I looked at my web performance best practices from the perspective of power consumption and CO2 emissions. YSlow grades web pages according to how well they follow these best practices. What if it could convert those grades into kilowatt-hours and pounds of CO2?
Letâ€™s look at one performance rule on one site. Wikipedia is one of the top ten sites in the world (#9 according to Alexa). I love Wikipedia. I use it almost every day. Unfortunately, it has thirteen images in the front page that donâ€™t have a far future Expires header (Rule 3). Every time someone revisits this page the browser has to make thirteen HTTP requests to the Wikipedia server to check if these images are still usable, even though these images havenâ€™t changed in over seven months on average. A better way to handle this would be for Wikipedia to put a version number in the imageâ€™s URL and change the version number whenever the image changes. Doing this would allow them to tell the browser to cache the image for a year or more (using a far future Expires or Cache-Control header). Not only would this make the page load faster, it would also help the environment. Letâ€™s try to estimate how much.
- Letâ€™s assume Wikipedia does 100 million page views/day. (Iâ€™ve seen estimates that are over 200 million/day.)
- Assume 80% of those page views are done with a primed cache (based on Yahoo!â€™s browser cache statistics). Weâ€™re down to 80M page views/day.
- Assume 10%, no, 5% of those are for the home page. Weâ€™re down to 4M page views/day for the home page with a primed cache. Each of those contains 13 HTTP requests to validate the images, for a total of 52M image validation requests/day.
- Assume one web server can handle 100 of these requests/second, or 8.6M requests/day. thatâ€™s six web servers running full tilt year-round to handle this traffic.
- Assume a fully loaded server uses 100W. Six servers, year-round, consume 5,000 kilowatt-hours per year or approximately 500-1000 pounds of CO2 emissions.
Wow, even more pressure for you to not be sloppy with your apps. Who knows if Green Peace will be using YSlow to find culprites and start boycotts because of it ;)
NOTE: Steve is co-chair of the O’Reilly Velocity conference which is taking place on June 23-24.
Posted by Dion Almaer at 6:58 am