Steve Souders asks "How green is your web page?" (Steve Souders:你的网页有多“绿”?)

Jesse Robbins Jesse Robbins 03.07.2008

Steve Souders, my Velocity conference Co-Chair and author of High Performance Websites, gave me permission to repost this great analysis:

How green is your web page?

Writing faster web pages is great for your users, which in turn is great for you and your company. But it’s better for everyone else on the planet, too.

200803071824.jpg

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.

I think this is a conservative estimate, but there are a lot of assumptions above. And six servers doesn’t sound like a lot. 5,000 kilowatt-hours is a drop in the bucket if you look at data center power consumption. But this was just one rule on one page on one site. Think about the impact of not gzipping, not minifying JavaScript, wasteful redirects, and bloated images. If we extrapolate this across all the performance rules across all sites the numbers are much bigger.

Make your pages faster. It’s good for your users, good for you, and good for Mother Earth.

-Steve

Steve has a SXSW Bookreading on Saturday @11 AM, and will be at the O'Reilly booth on Sunday from 3:30-4:30. Stop by and say hello!

Steve Souders,Velocity conference联合主席以及High Performance Websites作者,允许我在这里发布他的分析:

你的网页有多绿?

写快速的Web页面对你的用户是非常好的事情,当然对你和你的公司也都是好事。其实这对于世界上其他所有人更是个好事情。

Radar上一篇关于co2stats.com的文章启发,我从能源消耗和二氧化碳排放的角度审视我的Web性能最佳实践YSlow根据遵从这些最佳实践多少的程度来评测Web页面。如果把评测级别与千瓦小时和二氧化碳的磅数联系起来将会怎样?

让我们来看一个网站上一条规则的情况。Wikipedia是世界上前十名的网站(Alexa排名第九)。我喜欢Wikipedia,几乎每天都用。不幸的是Wikipeida首页上有13张图片,而且头的有效期还不足够长(Rule 3)。每当大家重新访问这一页时浏览器不得不向服务器发出13个HTTP请求来检查这些图片是否还可用,尽管这些图片平均七个多月都没有变化。

Wikipedia一个更好的办法就是在图片URL中放一个版本号,在图片改变的时候改变这个版本号。这就能让浏览器缓存一个图片一年或更久。这样不仅能让页面装载更快而且对环境也非常有益。我们来算笔帐:

*我们假设Wikipedia有1亿页面浏览/天。(我见过超过2亿/天的估算量。)

*假定这些页面80%通过可以缓存完成(根据Yahoo的browser cache统计),那么就是8000万页/天。

*假定其中10%或者5%是浏览主页,那么每天就是4000万页,每页包含13个HTTP请求来验证那些图片,一天就是5200万的图片请求。

*假定一个Web服务器一秒钟能处理100个这样的请求,一天就是860万个请求。那么这些流量就需要6台这样的Web服务器工作一年来处理完成。

*假设一个满载工作的服务器是100瓦,6台服务器一年就是5000千瓦小时的能源以及大约500到1000磅的二氧化碳排放。

我认为这是一个保守估计,里面有很多假设。而且6台服务器听上去不是很多,5000千瓦小时跟数据中心的能源消耗比也是九牛一毛。但这只是针对一台服务器上一个页面应用一条规则。想一下那些没有压缩的JavaScipt、毫无节制的重定向以及泛滥的图片。如果我们在所有站点推广所有性能规则那效果就大了。

把你的页面变得更快些,这对用户好,对你好,对地球母亲也好。

-Steve

Steve has a SXSW Bookreading on Saturday @11 AM, and will be at the O'Reilly booth on Sunday from 3:30-4:30. Stop by and say hello!

Discussion

Enter your comment (wiki syntax is allowed):
blog/steve_souders_asks_how_green_is_your_web_page.txt · 最后更改: 2008/09/22 由 radarman
O'Reilly Home | Privacy Policy ©2005-2009, O'Reilly Media, Inc.
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.