Welcome to WebmasterWorld Guest from 126.96.36.199
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:
I also came across this:
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?
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.
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?