Speed Up Your Website With HTTP Compression

What would you say if I told you that a very simple trick can save up to 75% of your bandwidth, visibly make your website load up to four times faster and make your visitors more satisfied? The data on the web is forecasted to grow exponentially over the next few years. In addition, even today the number one complaint among web users is lack of speed. The answer to this challenge is HTTP compression.

HTTP Compression?

The basic idea is to compress data being sent out from the server and have the browser decompress this data on the fly, thus reducing the amount of data sent and increasing the page display speed. The data is being compressed dynamically on the fly so you don’t need to upload any pre-compressed files.

HTTP compression is mainly useful to compress XHTML, CSS and JavaScript files because those are just ASCII text which is highly compressible. Gzip format is used to do this for its amazing compression rates. All browsers since 1998/1999 support this feature which is also called “content encoding” and is built in HTTP 1.1 (even though the content encoding was already included in HTTP 1.0). If you are interested in details you can read more about HTTP compression here.

How Much Bandwidth Will I Save?

Usually around 75% though it can be a bit more or a bit less. Let’s take a look at the following table and graph showing differences between compressed and uncompressed sites:

Website Size (uncompressed) Size (compressed) Percentage savings
google.com 3,873 bytes 1,412 bytes 63.5%
orbitz.com 44,183 bytes 9,046 bytes 79.5%
HTTP compression graph

The bigger the file the greater savings in bandwidth you will notice. If you are using much of JavaScript at your website you’ll see a really great improvement in the loading speed as well.

How to Get It Working

First, you need to be sure your web hosting provider supports this feature (most of them do already). If you’re not certain, just browse through their faq or ask them via email. I’m sure they will gladly help you. The “how to get it working” varies depending on what type of webserver is being used.

Considering the Apache 2.0 webserver the process is simple. Open the .htaccess file located in your website directory and fill in this:

AddOutputFilterByType DEFLATE text/html text/plain text/xml

Once you have done that the HTTP compression should be enabled. You can check it by using Web Page Analyzer. It will show you whether the content encoding is enabled or not plus some other interesting information concerning your website’s loading speed.

When other webserver is being used (IIS etc) you’ll probably need to contact your web hosting provider in order to get information on how to enable the compression.

Sit Back And Enjoy

Now you can enjoy your site loading faster and saving tons of bandwidth while not altering the look and the functionality. If you liked this article, please digg it or leave a comment.

This entry was posted in Miscellaneous and tagged . Bookmark the permalink.

One Response to Speed Up Your Website With HTTP Compression

  1. derek says:

    Great and useful tips.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>