Drupal has a rather efficient page cache for anonymous users. Also, there exist mod_gzip a module for Apache which will send the data compressed which saves bandwidth. however, mod_gzip will compress each served cache page anew. Since we generate the page cache in Drupal it is easy to also compress it and store it that way. Benchmarks indicate that a performance increase of about 13% can be achieved.
Further improvements could come from the fact that the cache table will be smaller and thus selects should be faster. My cache table was almost empty.
I still need to investigate under which circumstances gzencode uses the deflate or the zlib algorithm.
The docs seem to indicate that it would be gzip, but on my servers it is deflate. I wasn't successfull on finding anything on google so any insight any of you has to share would be appreciated.
This is important when inflating the cache again for old browsers that cannot handle gzipped pages (a very small minority of today's requests).
The attached patch has been well tested and not caused any trouble.
Comment | File | Size | Author |
---|---|---|---|
#6 | gzipped-cache_0.patch | 4.39 KB | killes@www.drop.org |
#2 | gzipped-cache.patch | 1.44 KB | killes@www.drop.org |
txt00005.txt | 1.07 KB | killes@www.drop.org |
Comments
Comment #1
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedThat's a patch, actually.
Comment #2
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedUpdated to apply to CVS, changed a bit after consultation with Steven.
Comment #3
Dries CreditAttribution: Dries commentedComment #4
killes@www.drop.org CreditAttribution: killes@www.drop.org commented1) Apache should detect that the output has been compressed already (we set the right header). If it doesn't it is broken.
2) True. To which help text should I add this? Also, this needs a database update:
delete from cache;
3) done.
Comment #5
Dries CreditAttribution: Dries commentedThere is a section about Drupal's cache system in the system module's help. I suggest adding it there.
Some more thoughts:
Comment #6
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedHere is an updated patch that includes helptext and update.inc. info. the other problems mentioned by Dries were probably solved long ago.
Comment #7
Dries CreditAttribution: Dries commentedCommitted to HEAD.
Comment #8
(not verified) CreditAttribution: commentedComment #9
el777 CreditAttribution: el777 commentedI found one bad bug when storing cached pages and working with mod_deflate.
My server: Apache/2.0.55 + PHP 5.1.2 as FastCGI
If cache and mod_deflate are enabled then anonymous pages are incorrect and cannot be showed to user. I tried to debug it with Fiddler - it showed length is transmitted incorrectly. I think it's due to the Apache attempt to compress already compressed page. So header Content-Length becomes incorrect. Of cource double-compressed page cannot be showed well.
Now I have to disable deflate for drupal-based site.
Comment #10
magico CreditAttribution: magico commentedClosing this again.
@el777: you should had open a new issue and not reopen this one almost two years old.
Comment #11
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedIn case anybody else is stumblign over this: I've tried this with apache2 (albeit not as fcgi) with mod_deflate and couldn't reproduce this.