Why and How to Use Gzip Compression on Joomla - JoomShaper

Why and How to Use Gzip Compression on Joomla

08 January 2020
Hits 12,218
4 min read
Why and How to Use Gzip Compression on Joomla

The answers to all your questions about Joomla Gzip compression.

When you are a web developer, having a solid foundation about the web would get you to places. You will be able to create powerful websites that novice developers can’t. This is the single most essential thing that will distinguish you from the amateurs. Therefore, let’s learn something fundamental today. What is Gzip, why should we use Gzip compression, how Gzip helps websites, and how to use Gzip on Joomla websites.

What is Gzip Compression?

The size of a webpage is what weight is to a physical object. We measure physical objects like bag/basket in Kg/lbs and vertical objects (web pages) in KB/MB. In the physical world, the more the size becomes the more energy it requires to move the object. Similarly, the more KB/MB of your web page becomes, the more (time) it takes to load a web page on the browser. 

Gzip compression is brilliantly simple and extremely powerful. 

To put it in layman’s term, if you were going to lift a bag of 10 Kg, you’ll be needing a lot less energy when you are lifting a bag of 1 kg. That’s what Gzip compression is. It reduces the size (weight) of the web pages without decreasing the content quality. 

Why Use Gzip Compression?

Since it’s established that the size of a web page determines how long it is going to take to load that page, we can go ahead and discuss how to reduce the size. This is where content-encoding comes into the picture. When as a user, you type something like google.com in the address bar of your browser and hit enter, the browser sends a request for the file http://www.google.com/index.html. Your browser then talks to the webserver. This is how it goes - 

  • Browser: Hey, can you give me the /index.html
  • Server: Ok, let me see if index.html is around
  • Server: Found it! Here, I’m sending the response code and the file
  • Browser: 300KB? Crap... waiting, waiting… Ok, it’s loaded now

Why and How to use Gzip compression on Joomla

So you see, this is why we should use Gzip compression. When you use Gzip compression on your Joomla website. It improves the performance and reduces the loading time dramatically. Say a 300KB web page can become 100KB if compressed. When a request is made for your website by a visitor, the server compresses the requested page and reduces its size significantly. And then sends it to the user’s computer. It’s the browser that does the decompressing and visualization in an extremely fast and unnoticeable way. 

The time and resource spent on compressing/decompressing a webpage are significantly less than loading a large file. 

The algorithm of Gzip is brilliantly simple. It locates similar strings and replaces them temporarily. The reason it works like a charm when applied to web pages is, HTML/CSS files use a lot of repeated text. As Gzip compresses the common strings, it reduces the file size up to 70%. 

How to Enable Gzip Compression in Joomla?

Since Joomla is an open-source CMS - built for the developers, by the developers. We are blessed to have powerful features already built in the system. To enable Gzip for your Joomla website go to the backend of your site.

Joomla backend > System > Global Configuration.

Why and How to use Gzip compression on Joomla

Then browse to the Server (tab) > Server Settings > Gzip Page Compression > and set the toggle to Yes. 

Why and How to use Gzip compression on Joomla

How to Check If Gzip Is Properly Enabled?

When you have configured your site, how do you tell if the compression is working properly? Well, you don't have to worry. There are plenty of tools available online to check that for you. Here's one of the sites I frequently use to check if my website is properly Gzip enabled. 

Why and How to use Gzip compression on Joomla

It is strongly advised that you use Gzip on your Joomla website. It helps to boost your website performance significantly. Which results in better user experience, better traffic and overall a better impression. Oh, did you know search engines care for the websites that have lighting loading speed? Yeap, that’s right! Enabling Gzip compression on your Joomla website even helps to rank better on Google.  

What would you like to know next? Put your thoughts in the comments below and let us indulge your curiosity. 

Karen Dunne
Karen Dunne
4 years ago
Thank you Joomshaper for another informative article that helps me be a better developer.
Saifur Rahman
Saifur Rahman
4 years ago
Thanks Karen for your kind words. We'll try to keep providing more and more informative articles. Do let us know what you'd want to learn about next.
PC
Philip Cabezas
4 years ago
Very good article. Well explained.
I would like to know about caching, how it affects an actual production website.
Having more items cache reduce speed?
In an example, a e-commerce platform builds a cache, and let's say I clear the cache how does this affect my customers, and their shopping carts, etc.
Saifur Rahman
Saifur Rahman
4 years ago
Alrighty, your wish has been granted Philip. Keep an eye on JoomShaper blog, your requested article could be available any day :D
PC
Philip Cabezas
4 years ago
I just ran a Gzip speed test. Investigation further does Gzip also compress Virtuemart files?

Thanks
Saifur Rahman
Saifur Rahman
4 years ago
If the Virtuemart files are in your server (which it is) then the files would be compressed. However, if any files are in an external server, like the files you saved in a CDN would be out of reach from Gzip compression. Like the ones, you inside the tag.

[img]https://www.joomshaper.com/images/2020/01/09/not_covered_page2.png[/img][b]Save/Open in new tab for an enlarged view[/b]

In the above image, you'll see only one file that is coming from google server, It is not going to be compressed.
Mo Ahmed
Mo Ahmed
4 years ago
For a little bit of extra speed and compression, it's a no-brainer to use Cloudflare, which even the "free" tier does more than what most people will need.

If you navigate to [Speed -> Optimisation -> Brotli Compression] it will take off some load from your servers by applying "gzip compression" via Cloudflare if it can't use Brotli encoding:

More details:
https://support.cloudflare.com/hc/en-us/articles/200168396
Saifur Rahman
Saifur Rahman
4 years ago
Thanks for sharing your insights, Ahmed. By sharing your knowledge, you are helping the community, and contributing towards the betterment of fellow developers.
OG
OASE Software GmbH
4 years ago
Google Page Speed improvments

Another interesting article would be, how to tweak a joomla site to raise the google page speed index. Because after the test there are often stated to reduce picture sizes, use mordern picture formats, get rid of rendering blockings.
But often it is hard to solve all these "suggestions" with joomla and sp page builder.
Some help from your site will be appreciated.

With kind regards
René
Saifur Rahman
Saifur Rahman
4 years ago
Yes, that's a major thing you pointed out René. Sometimes I feel the same. This is one area that should have a solid guideline for everybody. We would try to allocate some resources for this article. This would require some time but we would definitely try to publish such an informative article.
Mo Ahmed
Mo Ahmed
4 years ago
@oase - You can use JCH Optimise to help boost your speed index.

Also, make sure SCSS isn't set to compile on live-mode in the template settings and production mode is turned on within the SP Page Builder options.

That'll let JCH Optimise work a lot better and reduce response times to the ~100ms mark..
C
Clovis
4 years ago
Excellent article! Do you mind if i translate to portuguese and post in my blog?
Of course, i will refer the original artiicle, author and link it
Saifur Rahman
Saifur Rahman
4 years ago
Sure, go ahead. Knowledge is meant for sharing.
S
ssnobben
1 year ago
So question is how do you enable brotli content compression for Joomla?

Sign up for our newsletter

Don’t miss any updates of our new templates and extensions and all the astonishing offers we bring for you.