Skip to content. | Skip to navigation

Sections
Personal tools
What is this?
Hi, my name is Tom Lazar and I'm a Plone and Zope developer based in Berlin, Germany and this is my personal and professional (no big difference, really...) website.
 

Snow Sprint Day 4 - got RAM?

Filed Under:

From the "Now you're telling me?!" - Department ;-)

At the sprint I’ve been setting up and tearing down various Zope instances all the time using my instaPlone script. Due to the nature of a sprint I’ve been able to improve it thanks to the collective wisdom of everybody who was unfortunate enough to sit near me while tinkering with it. Extra props to Jodok from lovely systems who pointed out two neat and important aspects of configuring your caches in zope.conf.

Basically, you can use the cache-size directive in two different contexts inside the zope.conf when configuring a mount point: once on the same level where you specify the mountpoint and once where you specify the ZEO instance, that will be mounted there. The crux is, that the parameter has a different meaning for each context. In the latter case (zeo client) the parameter refers to the size of the cache-file on disk that’s created for this connection. In the first case (mount point) it refers to the number of objects to cache in RAM – and the default is 4000. This means, that if you have, say, 4000 images inside your ZODB of 1Mb each, the Zope server could eat up to 4Gb of RAM. One word: ouch! So Jodok advised to set it to saner value, such as 400. But, of course, YMMV and finding a practical value depends on the average size and total number of objects in your ZODB. An advanced usage he suggests for large sites is to create an explicit mount point for the portal_catalog and assign it a large cache-size (say, 100.000) because the catalog contains lots of tiny objects and a more conservative number for the rest.

In the timid hope to make any sense at all, here’s the zope.conf snippet that I now use for instaPlone:

<zodb_db main>
mount-point /
cache-size 400
<zeoclient>
server localhost:$ZEOPORT
storage 1
name zeostorage
var $INSTANCE/var
cache-size 25Mb
</zeoclient>
</zodb_db>

Oh, and here’s the updated version of instaPlone. It now uses Plone 2.1.2, creates symbolic links to the Plone products in order to conserve disk space (and significantly speed up execution), and of course, incorporates the new, saner cache-size values.