In April of 2010, Google officially announced that web site speed is an important ingredient for ranking search results. That's right: a slow web site might lower your search engine rankings! Most organizations understand that "organic" search results are a critical source of web traffic. Whether you are a local dentist or an international eBook seller like Amazon, search results are one of the best ways to grow your business.
In Google's words:
"Speeding up websites is important - not just to site owners, but to all Internet users. Faster sites create happy users and we've seen in our internal studies that when a site responds slowly, visitors spend less time there. But faster sites don't just improve user experience; recent data shows that improving site speed also reduces operating costs. Like us, our users place a lot of value in speed - that's why we've decided to take site speed into account in our search rankings. We use a variety of sources to determine the speed of a site relative to other sites."
Here's the exciting news: there are a number of cool new tools you can use to improve your site's performance!
Measure Twice!
My grandad was an amazing carpenter who built two of the houses he lived in. He would always say "measure twice, cut once," which is a relevant lesson for performance optimization. Before you start trying to improve performance, measure how you're doing today. At a minimum, run a one-time test at WebPagetest or BrowserMob. Consider setting up a free BrowserMob account to track performance improvements over time. Better yet, install your own Show Slow instance to watch performance specifics over time.
It's surprisingly common for some performance tweaks to actually hurt performance. Learn from the scientific method of making evidence-based decisions: test each change independently to validate that it's truly having the desired effect.
Use a Content Distribution Network (CDN)
CDNs (almost) magically store copies of your site content in hundreds of locations throughout the Internet. Rather than everyone in the world pulling images and video from your single web server, they can download rich content super fast from a nearby CDN server. This is a tremendous win for performance, and now that CDNs have adopted a cloud "pay-per-sip" pricing model, they are cost effective for almost any web site.
Prices range from 15-22 cents per gigabyte from providers like Amazon's CloudFront CDN and RackSpace's cloud offering of Limelight Networks' CDN. A vast majority of web sites will see significantly increased performance (especially for videos or downloadable files) for a few dollars a month.
There are a few tricks to using CDNs, including integrating with your site management tools, handling stale content and content expiration, and security for private content. Be sure you are comfortable with these issues before you post your content on servers around the world!
PageSpeed and YSlow
Both Google and Yahoo provide tools to help site developers identify ways to improve their site's performance. They are both built on simple lists of rules for web site optimization, and both provide friendly reports with advice for tuning your site or application. The tools are distributed as free Firefox add-ons that you can run on Windows or OSX. Google's PageSpeed and Yahoo's YSlow add-ons for Firefox also require the Firebug add-on. If you develop or test web sites, Firebug is pretty much an irreplaceable tool anyway.
We recommend using both tools, since they are based on slightly different rule sets and provide slightly different tuning advice.
Deploying mod_pagespeed
Just this month, Google took the rule set behind its PageSpeed Firefox add-on and built an Apache web server module that automatically implements many of the optimizations. That's right -- you get significant performance improvements without ever changing any of your code or content! Because mod_pagespeed can be deployed on a separate server using Apache's proxy features, you can test mod_pagespeed without even touching your production server. This approach allows you to do side-by-side "apples-to-apples" comparisons of the performance gains you are getting from the PageSpeed optimizations.
Another fantastic feature of Google's mod_pagespeed is its ability to insert tiny JavaScript "beacons" into your web pages. These beacons report back to mod_pagespeed when a page finishes loading in your end-user's browser. This "real-world" instrumentation is tremendously powerful for measuring the impact of changes you make to your web site, from infrastructure to platform software to custom code.
Varnish Web Cache
The Squid proxy has been around for many years, and it has a fond place in my heart since it was developed and is still supported by folks in the Boulder community. Squid was originally designed as a caching proxy for end-users, so that locations with a slow Internet connection could cache local copies of web content to save bandwidth. More recently, Squid has been configured as a "reverse proxy cache," meaning that it is deployed inline with web servers to help improve site performance. The basic function is the same, but with a reverse proxy, the caching servers are located near the web server rather than the user.
Squid is great, but it has grown organically into this role as a reverse proxy. Varnish Cache, on the other hand, has been built from the ground up for this purpose. Varnish offers a ton of sweet features, including load balancing with service health-checks, a robust configuration language, powerful redirect and rewrite handling, and a nice web management interface. The cautions regarding caching from the CDN section apply here as well!
HipHop for PHP
Facebook announced HipHop at the beginning of this year, and its popularity has grown faster than Justin Bieber's. Computer Science students know that a compiled language (like C++) is almost always faster than an interpreted language (like PHP). HipHop takes advantage of this knowledge and converts PHP code to C++ code. Once the C++ code is compiled, it is much faster than the PHP code was (like twice as fast)! Facebook saw a 50% reduction in CPU utilization when it deployed HipHop - can you imagine how many tens of thousands of servers that is saving them?
HipHop is complex, and it only works with high-quality, simple PHP code. It is definitely not something that can be deployed in a few minutes, but if you have a slow PHP application, it can make a tremendous difference. HipHop has been recently improved to make code that is 1.8 times faster than it could make in February! People are experimenting with HipHop and complex content management systems like Drupal and WordPress -- expect to see lots of action in this space in the future.
Other Resources
It's important to remember that page speed is only one of many factors in search-engine ranking. You should first ensure that your site contains interesting, relevant content! Still, it's a safe bet your users will go somewhere else if your site takes more than a few seconds to load. For more help with web site performance, try these resources:
- Good Content Management Systems (CMS) such as Drupal and WordPress do a decent job of optimizing and caching content with the right settings and add-on modules. If you're still using a home-brewed CMS (or - gasp - no CMS!), now is the time to switch!
- There are lots of great resources at Google's Speed Site, which offers articles, forums, and tools.
- Want to make your web site scream? Contact an engineer at AppliedTrust! We can help you figure out what tools and techniques will work best for your site, and will get them deployed quickly and cost-effectively.

Comments
Hmmm... Perhaps this goes without saying, but the first step is to find out where in your architecture things are slow.
For example, if the backend database is just plain overworked and your content is customized for every user, then varnish isn't going to do very much good, and it'd be better to spend time tuning your db.
Love the comment about measuring; when you are setting up browser mob tests, make sure you are testing common pages (which you can find via your web analytics tools).
Perfect! Thanks a lot!