Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mod_deflate vs mod_gzip

Can someone tell me the difference in the following scripts in terms of CPU load performance and compression?

<ifModule mod_gzip.c>  mod_gzip_on Yes  mod_gzip_dechunk Yes  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$  mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.*  mod_gzip_item_include mime ^application/x-javascript.*  mod_gzip_item_exclude mime ^image/.*  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*  </ifModule>    <ifModule mod_deflate.c>  <filesMatch "\.(js|css)$"> SetOutputFilter DEFLATE </filesMatch>  </ifModule>  
like image 513
Bachalo Avatar asked Apr 21 '12 01:04

Bachalo


1 Answers

Both these modules do the same thing: add gzip compression on the fly.

The one you should use these days is mod_deflate - it is the more modern and recommended one and is distributed with Apache. mod_gzip was an older third-party implementation and there is no good reason to use it anymore.

Don't be fooled by the names into thinking they use different compression schemes. They both use gzip (which is a format that uses a compression algorithm called DEFLATE). The latter is only called mod_deflate because the name mod_gzip was taken. They both will achieve the same compression levels with equivalent settings.

They have different configuration (which may include different default settings) so you need to find documentation for the specific one you're using.

like image 61
thomasrutter Avatar answered Sep 22 '22 16:09

thomasrutter