Software Review: mod_gzip trims bandwidth utilization by 77%

Posted by dave on Jan 19, 2004 12:59 PM EDT
LXer; By Dave Whitinger
Mail this story
Print this story

Let it not be said that I didn't tell you about the neatest apache module since the introduction of php: mod_gzip.

Almost all browsers on earth support gzip data encoding, yet almost no servers are configured to take advantage of this.

Through the miracles of gzip compression, you can configure your Apache to:

1) Determine that the browser is capable of accepting gzip. and then 2) Compress your web page and finally 3) Send the gzip compressed page to the visitor.

Now, this is useless if you are serving mostly content that is already compressed, such as images. However, if you have an extremely text-intensive site, such as discussion forums, technical manuals, and what-have-you, gzip can save anywhere from 70%-90% of your bandwidth. Additionally, instead of causing the visitor to download a 100K page, they only download about 10K of compressed data. Not bad!

Well, let's test this in a real world environment. I've been running mod_gzip for well over a year, but until today had never actually looked at its effectiveness... I just grabbed today's logfile for Dave's Garden, and, after removing all the images and such, I tailed out the last 5,000 hits.

My mod_gzip is configured to print out the "IN" and "OUT" numbers for each hit to my server. The "IN" field is the raw size of the text, and the "OUT" is the exact size of the compressed data that is then sent to the browser.

I wrote a script to look at these 5,000 hits and report on what it found. Here is the result:

Total bandwidth, before compression: 92,074,836 bytes. Total bandwidth, after compression: 21,301,279 bytes.

Average page size, before compression: 4,836 bytes. Average page size, after compression: 1,279 bytes.

Total bytes saved: 70,773,557 bytes. Average bytes saved, per hit: 77%.

See that? My server should have sent 92 megs, but only had to send 21 megs. WHAT A SAVINGS! It's only sending 1/4 the data that it would normally send without compression. That saved me big on bandwidth, and additionally the text and HTML pages are loading 4 times faster than my customers' competitors!

If you don't already have it, installing mod_gzip on your own Apache server is about the best thing you could do to improve your server.

  Nav
» Read more about: Story Type: LXer Features

« Return to the newswire homepage

Subject Topic Starter Replies Views Last Post
Thanks! rob 1 3,391 Feb 19, 2004 8:34 AM

You cannot post until you login.