[Zope-dev] RAMCacheManager and gzip

JanStiller T-Online JanStiller@t-online.de
Wed, 31 Oct 2001 05:50:57 +0100


Hi,

Is it possible to marry the RAMCacheManager and gzip?

I'm just working on a little shop and - for speed's sake - do 'ram-cache'
the article-listings and push all the Zope-Content through mod_gzip. With
this combination, I'm getting it 3x faster in Zope and 5x faster over the
wire (normally 64k). That's great so far. But I don't see any sense in
zipping cached content over and over, so I tried to zip the cached data in
RAMCacheManager. In my first attempt, i replaced:


ZCache_get (RAMCacheManager.py):

        entry.access_count = entry.access_count + 1
        return entry.data

with:

        entry.access_count = entry.access_count + 1
        ob.REQUEST.RESPONSE.setHeader('Content-Encoding','compress')
        return zlib.compress(entry.data)


The results:

1.
This works with Mozilla 0.96 only for very small entry.data. When I set
entry.data to 'XX', it works, but any real page gets
'<html><body></html></body>' as the result.

2.
This doesn't seem work in IE alltogether. (with 'Content-Encoding: gzip' -
zlib.compress != gzip!?)


I'm willing to spend some days of work for this feature, but although I have
2 years experience in Python I'm quite new to Zope and Internet-RFCxxxx's
and this is definitely a point, where I would appreciate some hints from
more experienced Zope-programmers (or a product, of course -- or the
statement, that this won't be possible... ;o)



regards

Jan Stiller


P.S. sorry, if my words seems a bit confused, I'm more used to reading than
writing english...