Output compression - what does 'gzip' in CMS do?

Discussion regarding Joomla! 3.x Performance issues.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
User avatar
jjonker
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Sat May 27, 2006 10:18 pm
Contact:

Output compression - what does 'gzip' in CMS do?

Post by jjonker » Mon Mar 12, 2018 10:29 am

Hi!

I am a bit confused about the compression / gzip of output files. Maybe someone can enlighten me...

When I turn on the option in the CMS server settings tot enable gzip compression, what does the CMS actually do?

I think it uses PHP output buffering (with ob_gzhandler function?) to compress data send to the browser. Right. But does this function use apache mod_deflate? Or mod_gzip? Or neither?

Is I leave this option off and my site ARE compressed (you can use online gzip compression check tools to check this, like https://checkgzipcompression.com) where does the compression come from? I check the .htaccess of a site, but that does not contain any code to trigger mod_deflate or mod_gzip. Or is there maybe a serverwide setting to enable and use mod_deflate?


Is mod_deflate is present on the server, does it by default compress the output? Or does it need to be activated/triggered by lines in the .htaccess?

If mod_deflate is used on the server (by default) and we also enable gzip in the CMS, will this cause issues because different types of compressions are used? Or maybe compression is added twice / layered?


Any insights and tips/suggestions on how to use compression are welcome! Thanks.

User avatar
jjonker
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Sat May 27, 2006 10:18 pm
Contact:

Re: Output compression - what does 'gzip' in CMS do?

Post by jjonker » Mon Mar 12, 2018 3:55 pm

After some more reading I found that the PHP function 'ob_gzhandler' uses zlib output_compression. I think (correct me if I'm wrong) this has not relation to apache mod_deflate. But I am not sure what the PHP zlib output_compression actually does. What does it compress in Joomla? And when is it decompressed?

Or am I totally wrong here? ;-)

If Joomla uses zlib output_compression (using the option Gzip page compression) would that in anyway conflict with having mod_deflate enabled as well?

We have a site that gives us some errors when both are used. For example downloads that appear on screen as scrambled text. Also some compression errors from the browser. I think maybe this has to do with double compression? (PHP and Apache) Is this possible?

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 6065
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Output compression - what does 'gzip' in CMS do?

Post by sozzled » Mon Mar 12, 2018 6:24 pm

The documentation states
If set to “Yes”, the web server will compress the content sent out from your Joomla site. This will speed-up page load times, especially for web site users who have a low-bandwidth connection. The default setting is “No”.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

User avatar
jjonker
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Sat May 27, 2006 10:18 pm
Contact:

Re: Output compression - what does 'gzip' in CMS do?

Post by jjonker » Tue Mar 13, 2018 8:53 am

Hi Sozzled, Yes I read that ;-) But I would like to know more about how this process words and/or what PHP functions / apache modules are used to achieve this. I can not fin d any info on this.

I found a lot of internet pages telling users to turn it off if they have compressions issues. But I can't seem to find out why and how...

What I would like to figure out is if the CMS Gzip functions can cause issues with mod_deflate. We have encountered some issues and decided to disable the CMS Gzip compression on all sites on our server (that has mod_deflate enabled).

But maybe these issues were a bug? I am not sure how these compression methods compare / interact / conflict with eachother.

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 6065
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Output compression - what does 'gzip' in CMS do?

Post by sozzled » Tue Mar 13, 2018 9:00 am

I can only tell you what I know. There's a setting in the Joomla Global Configuration. You can find more by using Google to understand the purpose of GZIP compression.

I use it myself. I have no problems with it. I don't need to know a lot more about "how it works"; the simple fact is that it works and it gives me a modest improvement in page load speeds. That's really all I need to know.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

urgan38
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sat Dec 30, 2017 5:51 pm

Re: Output compression - what does 'gzip' in CMS do?

Post by urgan38 » Thu Mar 15, 2018 11:38 pm

I have a somewhat related question (where it would help a lot to know more how this gzip option in joomla works really):

I just enables brotli compression in the apache webserver. This is an alternative compression that is more efficient as well as faster than gzip for typical web content. So it is preferred over gzip.

However I see that the joomla pages that my browser fetches are gzip compressed. The browser indicates that it would accept gzip, brotli and deflate. The server delivers gzip compressed content.

Does that have something to do with the gzip option? So would it be better to disable it and then the webserver does the compression? What are the advantages / disadvantages in having the webserver do the compression on the fly? What is more effective?

jonnybhoy
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Thu Apr 05, 2018 12:43 pm

Re: Output compression - what does 'gzip' in CMS do?

Post by jonnybhoy » Thu Apr 05, 2018 12:56 pm

I use GZIP in my wordpress site and it basically speeds up delivery of content to site visitors. Is this an option for Joomla? I'm thinking of switching if there are performance benefits.

User avatar
jjonker
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Sat May 27, 2006 10:18 pm
Contact:

Re: Output compression - what does 'gzip' in CMS do?

Post by jjonker » Thu Apr 05, 2018 1:05 pm

On our server there is compression enabled on the server level. So I disabled this option in Joomla, because using double compression (two methods) is probably not a very good idea...

Switching to Joomla is always smart ;-)


Post Reply

Return to “Performance - Joomla! 3.x”