[ZODB-Dev] Tuning the cache

Toby Dickenson tdickenson@geminidataloggers.com
Wed, 13 Nov 2002 16:38:29 +0000


On Wednesday 13 November 2002 4:03 pm, Neil Schemenauer wrote:
> We have a server that has lots of memory and our database is not too
> large.  Does anyone have hints on tuning the ZODB cache settings?

Could be.

>  I see
> the methods setCacheDeactivateAfter()

In recent ZODB releases this has no effect.

>, setPoolSize()

The number of concurrent connections allowed.

This is only slightly related to caching. If your connection pool is smal=
ler=20
than the number of threads in your application then their ZODB usage will=
 be=20
serialized. This means you can have bigger caches without using more memo=
ry=20
(at the expense of less concurrency)

[all of that last paragraph is from theory. Ive never used ZODB like that=
]


>, setCacheSize()

This should be your main interest. ZODB will aim to keep this many object=
s in=20
memory for each connection.  It will deactivate excess objects if the cac=
he=20
contains more objects than this setting at the end of each transaction. (=
or=20
when you call the garbage collector mid-transaction)

If there are fewer objects then no deactivation occurs. The cache remains=
=20
full.  (unless the cache is for objects in a version, where it will be=20
gradually emptied a few objects at a time for each transaction that passe=
s)


Increasing the cache size should reduce the activation/deactivation rate.=
 Zope=20
2.6 has a nice graphical profiling tool for this which you might want to =
look=20
at.


> but there is not documentation for them.

The ZODB wiki (http://www.zope.org/Wikis/ZODB/FrontPage) references these=
 two=20
pages, which might be useful.

http://www.zope.org/Members/htrd/cache/why
http://www.zope.org/Members/htrd/cache/api