[Zope] Versioned connectors from ZODB

Tim Peters tim.peters at gmail.com
Mon Jul 11 14:15:08 EDT 2005


[Etienne Labuschagne]
> ...
> I really need a "temporary" connection that I can discard.  This
> connection can have a much smaller cache than the normal connections
> as it makes very little difference in the speed of data loading.
> Second prize is a connection that will only be used by a specific
> process and never used for other processes.  Versions solves this for
> me.

Maybe like death would solve my problem with overdue taxes <wink>.

Connection pools are associated with DB instances, so if you want
connections with different characteristics, create another DB
instance.  Like, e.g., in the ZODB 3.2 line,

    otherdb = ZODB.DB(storage, cache_size=100, pool_size=2)

Then connections obtained via otherdb.open() will hang if two threads
already have connections from `otherdb` (that's the effect of
`pool_size`), and will have ZODB memory caches that strive to keep no
more than 100 objects in memory across transaction boundaries (the
effect of `cache_size`).

This is easiest if you're using ZEO (ClientStorage), because doing
otherdb.close() also calls close() on the DB's storage.   If you,
e.g., share a FileStorage directly across multiple DBs, closing any
one of the DBs will close the FileStorage across all the DBs using
that FileStorage.  ZEO makes it easy to open multiple ClientStorage's
"on top of" of a single FileStorage, which can be closed
independently.  If you never close otherdb, this isn't an issue.

This answer assumes you're using ZODB directly.  I don't know details
of how to spell it from within a Zope application (if that's what you
need -- unsure).


More information about the Zope mailing list