How does Google serve up its webpages so fast?
Everybody knows Google is fast. But why is it so fast? There
are quite a number of reasons behind its amazing speed. Among
other things, Google uses a couple of machines to serve as
the front-end for load balancing. But today, we are not going
to dive into the details of load balancing. Instead, we will
be looking into another factor that contributes to Google's
lightning celerity.
Before we uncover the mysteries, let's digress a bit to talk
about your habits of using email. When you have a big file
that you want to send to your friend by email, what would
you usually do? In order to save time and bandwidth, you might
zip up the file to make it smaller in file size and then send
the zipped file to your friend. Now that the file is smaller,
it takes less time to transfer the file over the Internet
because it occupies less bandwidth. Makes sense?
Let's jump back to the topic of the article. What will make
the transfer of a webpage faster? Assuming the bandwidth is
fixed, the only way to speed up the transfer of a file (e.g.
a web page) is to make it smaller. In other words, if we can
compress the file and send the compressed version over, it
may greatly reduce the transfer time, depending on how good
the compression is. You may question: "Hey, it's no use
obtaining a compressed file unless I know how to decompress
it!". You're absolutely right. In order for this trick
to work, the receiver of the web page (i.e. your web-browser)
has to know how to decompress the file so as to restore it
to what it was.
Yes, it's just that simple. Now you know the theory. It's
time to look at how it actually works in reality. Say,
you point your browser to www.google.com, HttpRevealer
will show you what happens behind the scene:

The upper pane shows you the HTTP request issued by the web
browser (in this case, it's Netscape 4.7). Basically, this
request says to the server at www.google.com, "Hey,
please give me the default document located at your root level.
I use the HTTP protocol version 1.0.". If you read the
request carefully, you will notice this line among others:
With this line, the web-browser is telling the server, "Hey,
you know what, I am smart. I know how to handle (or decompress)
files compressed in gzip.". gzip is one of the
many algorithms to compress files.
Okay, the HTTP request was easy enough to understand. Let's
move on to see how the server responds.
The lower pane of HttpRevealer shows you the HTTP response
from the web server. Basically, the response answers the web
browser: "Okay, I've found the document you asked for.
It's an HTML document. Here you are...". This time, pay
special attention to this line:
Since the web server was told that the web-browser (Netscape
4.7) is capable of handling gzip, the web server decides to
compress the web page (in gzip) before it sends it over. The
above line tells the web-browser that the content in the response
is encoded (or compressed) in gzip, so the web-browser will
know it should decompress the file before displaying it.
That's that. Did it sound amazingly simple to you when you
discovered how Google does its tricks. I hope you enjoyed
the discussion. I found out the above with the help of HttpRevealer.
You can explore the web yourself too! [See
more info]
Steven Chau
Go back to the Index of Articles
Google is a registered trademark of Google, Inc.
All other marks are properties of their respective owners.
|