[ZODB-Dev] Sharing (persisted) strings between threads

Hanno Schlichting hanno at hannosch.eu
Wed Dec 8 08:03:16 EST 2010


On Wed, Dec 8, 2010 at 11:06 AM, Malthe Borch <mborch at gmail.com> wrote:
> With 20 active threads, each having rendered the Plone 4 front page,
> this approach reduced the memory usage with 70 MB.

Did you measure throughput of the system? In the benchmarks I've seen
threads numbers of 3 or above will perform worse than one or two
threads. At least with the GIL implementation up to Python 2.6 you get
much worse performance the more threads you have on multicore systems.
There's good explanations of the behavior done by David Beazley at
http://www.dabeaz.com/blog.html.

In default Plone 4 we have two threads per instance. If you have more
than a single ZEO instance you should reduce the thread number to one.
We also set a default Python checkinterval of 1000 (instructions),
which prevents thread switching for long stretches of time to counter
the GIL in the two thread case.

So while sharing data between threads might sound interesting, it's
not of much help in Python.

Hanno


More information about the ZODB-Dev mailing list