Sunday, January 18, 2009

MemcachedPageCacheManager- A faster PageCache

With Plone's CacheSetup tool, it's pretty easy to get better performance out of Plone. In fact, with really aggressive caching, using Varnish as the proxy I've gotten up to 1000 reqs/sec.

Varnish and Squid are so great, why something else?

Fear of stale content. There are some scenarios where there is no reliable way of purging the proxy cache when a cached item has changed. In these cases, caching in memory via the Page Cache Manager is the solution. The alternative would risk serving stale content when an item is changed.

Cache Setup handles all of this on your behalf, except I had a yearning for faster performance.
So I got a hold of MemcachedPageCacheManager (had to do an svn checkout from the collective). I also need to install memcached (on Ubuntu that's 'aptitude install memcached).

The performance on a modest server (1 GB Ram, 1.6 ghz) looked like this:

Without CacheSetup: 0.2 requests/per/second
With CacheSetup installed and enabled (no tweaking): 3 to 4 requests/per/second
With CacheSetup installed and MemcachedPageCacheManager: 40 requests/per/second

So doing a drop in replacement of PageCacheManger with MemcachedPageCacheManager gave me a 10 fold performance increase.

Important Notes

MemcachedPageCacheManager does not provide a way to edit the "Page Cache threshold entries" and the "Cache cleanup interval (seconds)". As a result this breaks the Cache Settings > Memory Tab (page_cache_config.cpt). I created my own version of the "Memory Tab" via, mostly because, cosmetically it looked better.


looked better than This:


hexsprite said...

Great post! You should get this blog added to Planet Plone.

Also you had described the various scenarios in IRC re: when you might want to use this module vs. the varnish which you don't touch on in your post. Can you reiterate those here?

Unknown said...

is your patch has been report to the collective ?

Sign up for my upcoming Plone 5 Book & Video tutorials

plone 5 for newbies book and videos