The beauty of gzip compression

I have just discovered the magic of gzip compression on web pages. I knew it would be good, but I was blown away by the saving.

Without gzip compression, the homepage of the Oz Broadband Speed Test was 32.37 KB (33142 bytes), with gzip turned on the same page was 7.61 KB (7789 bytes).

That’s a massive 75% saving in data. While it might not seem like much, on a high trafficked site it really starts to add up.

Turning gzip on is also easy, with the use of an .htaccess file on an Apache web server, and is done with a single line of code.

    php_value output_handler ob_gzhandler

I’m not sure how much extra load this will add to the server, but I am hoping it is minimal. I’ll keep an eye on this over the next few days.

The best thing with this is that if your browser doesn’t support any compression methods (highly unlikely in today’s browsers) then it will simply send the page back without compression.

It’s really win win.

I should also point out that this only compresses PHP files, and not CSS, JavaScript or images.

One thought to “The beauty of gzip compression”

  1. Just don’t allow any whitespace above wp_head, for whatever reason ob_gzhandler and whitespace don’t like each other and will throw errors.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.