Everyone talks about the benefits of using gzip on Joomla sites (you can enable it by logging in to the backend and going to Site -> Global Configuration -> Server, and then choosing “Yes” next to Gzip Page Compression), but nobody tells you the whole story. The whole story is that gzip, in general, only works well on small websites, where it’s not really needed…
Let us explain ourselves, but before doing that, let us give you an idea on how gzip works…
So, how does gzip work?
Gzip is a small program on the server that compresses the HTML code before sending it to the client. So, if you visit the homepage of a Joomla website, Apache redirects the call to PHP, which then parses the page and generates the HTML code, and just before sending that HTML code to your browser, the gzip program compresses the HTML, and tells Apache that it’s done, and then Apache pushes the HTML to you. Once the browser receives the compressed (or zipped) HTML, it’ll unzip it (all modern browsers support this functionality) and will display it properly for you to see it.
So, why is it good?
It’s good because those with slow connections will save on bandwidth – for example, if the HTML page is 1 MB long (without the media, which is rare), then the zipped version can be a tenth of that size (or even less), thus saving the user some substantial bandwidth, and making the site load much faster.
And why is it bad?
It’s bad because it only works on small sites – if you have a large site, and that zipping program runs for every request, then your server’s load will increase dramatically (we’re talking about a triple digit load here), and your website will, sooner or later, crash. You will start feeling the gzip reverse effect once you have a few thousand articles on your Joomla site and a few thousand visitors every day.
We’re amazed that this wasn’t mentioned anywhere else because it’s such a huge issue: several of our large clients had serious problems and downtime because of gzip. They thought they were doing the right thing by having it enabled, but it turned out that it was making things worse, much worse!
But even on small sites, is gzip needed?
Not with today’s connection speed no – the performance gain is not even noticeable. Gzip was a good idea back in the days when people were using 56K modems – not anymore. Nowadays virtually anyone who’s connected to the Internet (on this planet) has at least a 1 Mbps connection, so loading speeds, are rarely, if ever, the visitor’s issue.
If your website has gzip enabled and it’s causing you issues, then you can disable it confidently, because it’s not that useful anyway. If you’re still not convinced, please contact us and we’ll do the explanation for you. Note that our affordable fees apply!
Very helpful article thank you. Never even thought about that.
I have two questions. What if one enables cache + gzip. Will it still run for each request?
Does gzip also work on each ajax request?
Hi Eythymios,
1 – Yes, if you enable Joomla’s cache then gzip will still zip the content. Joomla’s own cache is mainly about reducing the load on MySQL.
2 – Yes, gzip will encode Ajax responses, but, when you parse them, you will need to make sure to set your “Accept-Encoding” header to “gzip”.