Why is Google so Fast?

calendarNovember 5, 2007 in HTTP , Optimization

It’s no coincidence that the most successful search engine on the planet is also the fastest to return results. Here are some time charts from HttpWatch for Google and its two closest competitors; Yahoo and Live.com:

Google.com returns its results page in 0.155 seconds:

Timechart for Google results page

Live.com returns its results page in 0.619 seconds:

Timechart for Live.com results page

Yahoo returns its results page in 1.131 seconds:

Timechart for Yahoo results page

These screen shots were created by visiting the home page of each search engine with an empty cache and then entering a search term while recording with the free, Basic Edition of HttpWatch

After clicking the ‘Search’ button, the results of the keyword search are delivered by Google approximately four times faster than Live.com and seven times faster than Yahoo. How do they manage to do this?

Clearly, the time taken to lookup the results for a keyword is crucial and there’s no denying that Google’s distributed super-computer reputedly running on a cluster of one hundred thousand servers is at the heart of that. However, Google has also optimized the results page by applying two of the most important aspects of web site performance tuning:

  • Make less HTTP requests
  • Minimized the size of the downloaded data

The Google results page requires only one network round-trip compared to the four and eight round-trips required by Live.com and Yahoo respectively. They have achieved this by ensuring that the results page has no external dependencies. All its style information and javascript code has been in-lined with <style> and <script> tags.

You might be wondering how the Google logo and other images are rendered on the results page since Internet Explorer does not support in-lined image data. Well, that’s a little more subtle. When the user visits the Google home page, the image nav_logo3.png is pre-loaded by some background javascript (hence the separate page group in HttpWatch):

Pre-loading of Nav_logo3.png

The image wasn’t actually displayed on the home page but it was forced into the browser’s cache. When the search results page is rendered by the browser, it doesn’t need to fetch the image from google.com because it already has a local copy. It didn’t even register in HttpWatch as a (Cache) result because Internet Explorer loaded the item directly from its in-memory image cache.

As you can see from the screenshot, nav_logo3.png doesn’t just contain the Google logo. It also has a set of arrows and the Google Checkout logo. This is because the results page uses a technique called CSS Sprites. All the images used on the results page are carefully sliced out of this single aggregate image with the CSS background-position attribute. The use of this technique has allowed Google to load the search page images in a single round-trip.

The other major advantage of the Google results page, over its competitors, is the amount of data that is downloaded. You can see this by looking at the highlighted values in the HttpWatch page summaries:

Google results page summary

Live.com results page summary

Yahoo results page summary

The Google results page only requires 6 KB of data to be downloaded, whereas Live.com requires 16 KB and 57 KB for Yahoo. All three search engines use HTTP compression, but Google’s results page requires less data because:

  1. Their page is simpler so it requires less HTML
  2. They’ve avoided extra round-trips for script and CSS. Each round trip requires HTTP response headers and adds to the total amount of data that has to be downloaded. In addition, HTTP compression tends to be more efficient on a single large request rather than several smaller requests.
  3. The HTML is written to minimize size at the expense of readability. It contains very little white space, no comments and uses short variable names and ids.

Not only do these techniques improve the performance of the Google results page, they have the added benefit of reducing the load on the Google web servers.

8 thoughts on “Why is Google so Fast?

  1. shinyr says:

    it’s a simple optimization.
    why the others don’t care about this?

  2. Jordan Clark says:

    Excellent article, very well researched. However, Google is an extreme case – they exist in a very competitive market. I would not advocate this way of coding for the average website; their code flies in the face of most modern coding standards.

    Then again, it’s never done their bank balance any harm!

  3. Gaz says:

    That image keeps popping up in the top left hand corner of all my google searches, over the content ( or google logo to be more exact “top left” ) Sometimes it appears multiple times at various points down the page.

    I should point out that Im using IE8 in quirks mode, but still, very annoying. I thought I had some kind of strange spyware…

    Doesnt happen in Firefox either just IE8 ( Quirks mode for IE7, Im sure its probably just a strange beta issue )

  4. Tim says:

    Wait.. no.. this is rubbish, sorry.
    What you’ve said is true and it *will* reduce load on servers, but it won’t increase the speed for the end user by much.
    Google rely on complicated search algorithms and a complex mix of hardware and software to query such a massive database, so quickly.
    There is talk that parts of the database are always loaded in RAM, and Google uses a custom filesystem.
    Those are things that will actually make a difference for the end user, not reducing the number of requests (and remember, the website servers will be different to the servers that query the database).

  5. Yes, Google does some clever things to make its search query fast, but if they didn’t also pay attention to front end issues such as page size, round trips and caching all that effort will be wasted.

    Steve Souders (Google’s chief performance engineer) has a ‘Performance Golden Rule’:

    “80-90% of the end-user response time is spent on the front-end”

    See slide #8 of his ‘Higher Performance Websites’ talk:


    This blog post acknowledges the power of Google’s distributed super-computer, but then goes on to show what they also did on the front end to ensure that search pages load as fast as possible.

  6. Djane says:

    wow… google really pays attention to small details. Hence making a big difference.

Got Something to Say?

Your email address will not be published.

Ready to get started? TRY FOR FREE Buy Now