On Oct 31, 2007, at 7:35 AM, Roché Compaan wrote:

Thanks for the explanation.

The actual insertion is very fast.  Your benchmark is dominated by
the time to serialize the changes due to an insertion.

You should usually have just 2 instances to serialize per insertion of
a new instance:  the instance itself and the b-node that points to the
instance.  An insertion may also cause changes in 2 or several b-nodes,
but those cases are less likely.

Serializing your simple instances is probably fast, but serializing
the b-nodes appears to be taking much more time, and probably accounts
for the large number of calls to persistent_id.  B-Nodes with higher
branching factors will have more parts to serialize and they will be
slower.  If you can cut the b-node branching factor in half, I bet your
benchmark will run almost twice as fast.

I think the default branching factor is large in ZODB because that
can be good for fast reading.  It is bad if you want fast writing.
If you want fast writing, use a small branching factor.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to