Web Hosting Talk







View Full Version : Whats mod_gzip


ClusterMania
11-04-2001, 06:50 AM
Dektong used it to save on bandwidth. What kind of files does it compress and how does it work? Would it help on a freehost to compress content? What kind of tools can I use to reduce file size automaticly as they are uploaded on some files?

Walter
11-04-2001, 06:57 AM
mod_gzip is an Apache module which detects if your browser supports compression, if yes it compresses the files on the fly and sends them to the browser. This is completely transparent.
Which files are compressed can be configured.

ClusterMania
11-04-2001, 07:00 AM
Originally posted by Walter
mod_gzip is an Apache module which detects if your browser supports compression, if yes it compresses the files on the fly and sends them to the browser. This is completely transparent.
Which files are compressed can be configured.

So it would be super high cpu usage if mod_gzip was use to compress every image viewed?

Walter
11-04-2001, 07:13 AM
Of course mod_gzip increases the cpu load. I only use >=933 Mhz machines for hosting, so far it has put no stress to that CPUs.
And of course you can turn it off your e.g. .JPG files which are already compressed!

Cateye
11-04-2001, 07:17 AM
So it would be super high cpu usage if mod_gzip was use to compress every image viewed?
Yes. Be careful configuring mod_gzip, especially when you don't have high end server with redundant memory. the use mod_gzip is mainly meant to save bandwith, I think.

WesternMedia
11-04-2001, 12:10 PM
I'm a newbie with mod_gzip.

Is it possible to have compressed version of files already stored?

Anyone wanna give us a short tutorial?

eva2000
11-04-2001, 05:57 PM
Originally posted by WesternMedia
I'm a newbie with mod_gzip.

Is it possible to have compressed version of files already stored?

Anyone wanna give us a short tutorial? http://www.i4net.tv/marticle/get.php?action=getarticle&articleid=12 :D

Janet
11-05-2001, 05:07 PM
Hello :) A few questions for the web hosting gurus:

I thought mod_gzip could only be used by scripts that called the module? (like message boards) Or is it even for plain html files as well?

I'm on a shared server with mod_gzip installed. Do i have to do anything to enable it for my web site?

Do all current browsers support compression? (IE4/5/6, netscape 4/6) It sounds like compression would not only save bandwidth, but also speed up loading of the page too.

Lmax
11-05-2001, 05:17 PM
Originally posted by Janet
Hello :) A few questions for the web hosting gurus:

I thought mod_gzip could only be used by scripts that called the module? (like message boards) Or is it even for plain html files as well?
It compresses all cgi, php and html files. With some message boards you can adjust the compression rate. Saving more bandwidth, but also taking up more bandwdth


I'm on a shared server with mod_gzip installed. Do i have to do anything to enable it for my web site?
No

Do all current browsers support compression? (IE4/5/6, netscape 4/6) It sounds like compression would not only save bandwidth, but also speed up loading of the page too.
Most current browsers support it. Netscape and IE sure do. And on slow speed connections like 28k8 modems it sure saves a lot of time



So it would be super high cpu usage if mod_gzip was use to compress every image viewed?

I used mod_gzip on a RAQ3 and it worked fine. It sure takes up some CPU but not a lot.

Walter
11-05-2001, 05:29 PM
Originally posted by Lmax
It compresses all cgi, php and html files.

Which files are compressed can be configured.

dektong
11-05-2001, 06:02 PM
Hm ... I have been playing around with mod_gzip for about 6 months, and I think I know a little bit about this very nice apache module. In fact, I think it is one of the most important apache module that every web server should have ...

As everybody has mentioned it (but for the sake of completion, I will mention again), mod_gzip automatically does on-the-fly compression for files being transfered via your http protocol (usually port 80). Mod_gzip will detect if the browser support gzip compression (NS/MS ver 4+ do support this as well as other browsers). If the browser supports this compression, mod_gzip will compress the file and sent the compressed files to the browser. Otherwise, it won't compress the files. And since it's apache module, it won't compress any files being transfered via FTP protocol. But since in general, 95%+ of the trasnfers are http related, mod_gzip will save you a lot of bandwith. This is one of the main advantages of using mod_gzip, the other one ... since the files are being compressed, it takes shorter time for people to download the files via their browser, hence they will feel they are accessing your site faster.

In my experience, mod_gzip will in general capable of compressing files (in the average) a factor of around 2-3. So, for example, if you have a file of size 49KB and it's being compressed (in less than one second) to 21KB, then for this one second time you lose to compress the file, your visitor will save 4 seconds to download the file (assuming using 56Kbps modem). Hence in total, your visitor will save more than three seconds to download your file.

This is what I know, mod_gzip has its gzip compression level set to 6 by defauly and currently I have no idea how to change this value. It's probably not going to do you any better if you change the gzip level to >6 since you won't get any better compression result yet it will take more of your CPU resources/time to do the compression. On the other hand, with the same reason, I don't think setting it to a level of 6 will save me more bandwith than setting it to a level of 3 or 4 but setting it to gzip level of 3 will definitely free up some of my CPU resources for other important things ...

I am not sure how much time/CPU reources this gzip compression take. For sure, if you are running a very busy web server, the time/CPU resources taken may not be negligible ... But currently my web server is serving about 100000 page views per day and around 500-700000 hits per day. I turned off mod_gzip the other day to see how much will it lower the CPU load, it seems to me (still need to take a look at this more carefully) mod_gzip is far from being a major contributing cause of your server load.

The kind of files capable of being compressed is, I think, almost anything that goes through your http protocol. Well, anything that you have defined (although it would be stupid to define a .gz file to be compressed by mod_gzip). You can also define what is the minimum and maximum file size where mod_gzip will try to compress.

It was really interesting to have mod_gzip running for a long period and suddently you turn it off. Indeed! I was able to verify several things ... First, my client's (and my server's mrtg) webalizer increases by a factor of around 3 or more, from about pushing 900MB-1GB to pushing about 2.7-3GB of of data transfer per day. Similarly with my MRTG graph ... It really impresses me actually with the amount of bandwith saved.

Second, I was also able to verify what causes the mysterious problems that most host have been asking, the difference between CPanel's bandwith monitoring (bandmin) and webalizer's. With mod_gzip turned on, I got about a factor of up to 3 times between bandmin and webalizer, but after turning it off, I realized that bandin and webalizer are withing 0.5%-1% of each other! I guess/believe that any host having a huge differences between webalizer and bandmin will have this mod_gzip intalled!

Anyway ... this is my experience with mod_gzip. It has helped me and my clients save bandwith (although to be honest, I would better off not have mod_gzip installed since I can make more money by having my clients pay for bandwiht :D). Good luck with your experinece with mod_gzip!

cheers,
:beer:

PS: Hey Eva2000, that article you have is where I started my experience with mod_gzip! Thanks for the article!

Janet
11-05-2001, 06:30 PM
Thanks for the very thorough overview of mod_gzip. :)

[deleted dumb question]

Woody
11-05-2001, 06:48 PM
Message boards still ouput to Apache. Perl is just a step in between.

Tiggy
11-06-2001, 02:34 PM
I don't suppose there is anything like this mod for a windows server is there? Sounds like a great way to save on bandwidth and visitors time.