Save Bandwidth and Speed Up Your Site With Apache 2 and mod_deflate

If you’re a website operator or up-and-coming blogger, you may have noticed your bandwidth bills growing larger each month. Fortunately, there’s a very easy way to transparently compress your pages and save bandwidth and download time for you and your visitors. Version 2 of the Apache web server features a module called “mod_deflate”, and if configured correctly, it can dramatically decrease your bandwidth usage.

According to Apache’s website, “The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.” Basically, it allows you to automatically compress certain file types before the server sends the files to the browser (html, css, etc). The browser then decompresses the files once it has received them.

I first heard of mod_deflate when searching for a new host about 2 years ago. I was looking for a host with PHP5 and came across TextDrive. Besides PHP5, one of the features that TextDrive was boasting about was mod_deflate. After seeing the advantages of mod_deflate compression, I wonder why so many other hosts still don’t offer this feature (or Apache 2 or PHP5 for that matter).

I found a great website template from Open Web Design and did some tests to see how much bandwidth savings mod_deflate would give us on a simple website template.

The first page I tested is a simple one-column design with minimal graphics. The savings here are clear. Without mod_deflate, the page and all of its dependent files come in at 64.53 KB, with mod_deflate it’s only 47.90 KB (74% of its original size). This is a 16.63 KB savings in bandwidth without any changes to the page. While 16.63 KB doesn’t seem like a lot for those of us with high-speed connections, I’m sure visitors to your site with dial-up connections will be happy for the extra speed.

Because graphic files are already compressed, they are not effected by mod_deflate. This means that pages that have a lot of graphics will not see as large of a drop in total size. This more complex page with more graphics was 88.09 KB uncompressed, and 70.45 KB with mod_deflate. This is still a 17.67 KB bandwidth savings, but overall the page is only 80% of the original size.

Many hosting companies do not offer Apache 2 or mod_deflate. If you’re in the market for a new host, make sure to ask them about this feature before signing up. Personally, I recommend TextDrive because they offer cutting edge software with good tech support.

If you run your own server, you can set up mod_deflate fairly easily. Here are some pages with more information.

Welcome to Starry Hope!

Starry Hope is a site about technology with a focus on open source software and Linux based operating systems. I try to post helpful information for others as I solve problems in the process of my work and play with computers. Be sure to subscribe to my RSS Feed or follow me on YouTube and Twitter.-- Jim Mendenhall