homepage Welcome to WebmasterWorld Guest from 23.20.220.61
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
mod_gzip Setting up and Usage
ukgimp




msg:1511015
 4:02 pm on Dec 5, 2003 (gmt 0)

Hello

This is a new one for me. I have a server with mod_gzip available but not installed. My concerns are activating it a racking the whole server.

I found this but there appears to be no low level guide to this process:
[faqs.org...]

I also came across this:
Article [webreference.com]

I suppose I am after the pitfalls, for example if a browser does not support the unzip process.

Should I zip on the fly or store cached versions of the page which have been gzipped. Or something else?

Cheers

 

jdMorgan




msg:1511016
 12:19 am on Dec 6, 2003 (gmt 0)

ukgimp,

Haven't done it (hmmm, you've got me thinking, though) but I can answer some concerns:

> I suppose I am after the pitfalls, for example if a browser does not support the unzip process.

The browser tells the server what formats it can handle using the HTTP-Accept header. The server can look at that header and send either the gzipped or plain-text versions. For example a simple mod_rewrite rule could be used to do this -- check the accept header and then either serve the static html page to browsers that don't accept gzip, or for those that do, serve the pre-compressed version (if it exists) or call the gzip routine to compress it if not.

> Should I zip on the fly or store cached versions of the page which have been gzipped. Or something else?

It would be a good idea to cache the gzipped files if you are hosted on a busy server. Otherwise, you effectively gain bandwidth, but at the cost of repetitive computation. On a busy server, getting enough CPU time to do the compression might be as slow as sending the uncompressed file - not likely, but possible.

A mixed approach may be best; gzip and cache the most-popular, largest pages, gzip (only) the medium-popular and medium-size pages, and don't do anything with the least-often-accessed and small pages. Reviewing your stats regarding bandwidth and CPU time consumed will show you the way.

While it might seem easier to just gzip everything, compressed-format files like jpg images and mp3 audio gain no benefit at all from being gzipped, and just cost you wasted CPU time, so some discrimination will be necessary.

Another issue is that you will need to modify your cache-related server response headers to include the "vary" parameter. This basically tells proxy and browser caches to cache the plain and gzipped pages separately, based on MIME-type.

Jim

ukgimp




msg:1511017
 11:30 am on Dec 8, 2003 (gmt 0)

Jim

Thanks for taking the time to answer my post.

I was thinking if the approach. I have a caching script working quite well. Thanks to the WebmasterWorld member who helped me. You know who you are). I suppose I was wondering what percentage of people donít have the ability to read gzipped files. If it is low I could see an argument for compiling a monster set of gzipped cached pages and then serving any non compliant ones with a straight version from the DB. Clearly you would need top watch how things progress and consider having two sets of repositories if you non gzip compliant requests increase to a significant level.

>>While it might seem easier to just gzip everything,

I was thinking of just the text pages like php and htm. My images are already compressed and if I have it right compression of compressed files does not work too well. As in winzipping WinZip files, apparently they get larger (have not tested this).

>>Another issue is that you will need to modify your cache-related server response
>> headers to include the "vary" parameter. This basically tells proxy and browser
>>caches to cache the plain and gzipped pages separately, based on MIME-type.

Any tutorials or WebmasterWorld threads on this one?

Cheers

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved