[Zope-DB] leaking connections or what? (zope 2.5 with DB2)

Dieter Maurer dieter@handshake.de
Wed, 4 Dec 2002 23:02:24 +0100


Charlie Clark writes:
 > ...
 > this brings up an interesting question: how does RDBMS connection pooling 
 > work under Zope? How many connections are open at any one time, how much 
 > control do you have over them and how do they work.
Most DA's I have seen store a low level connection object
in the DA instance as a volatile (i.e. "_v_*") attribute.

In this way, the connection is closed when the DA instance is flushed
from the ZODB cache.
Furthermore, each Zope worker thread (the default number is 4)
can have its local copy of the "_v_" attribute and therefore
an open database connection.

 > I've only had experience with Gadfly, MySQL and PostgreSQL but it seemed 
 > that if I was running a complex query on MySQL that I couldn't run any 
 > other queries at the same time using the same DA.
DA's are classified according to the supported threading level.
(There is a document about that on Zope.org).

Your MySQL DA seems to serialize on module level.
This is necessary when the database client library is not reentrant.

 > This doesn't appear to be 
 > the problem with the PostgreSQL adapter.
Your PostgreSQL adapter seems to support a higher threading level.

 > Apart from licensing problems this could be a real bottleneck on a big 
 > website.
Keep the number of DA instances low.
Reuse them, if possible.

 > Is there a list anywhere of which DAs do what?
Read the above mentioned document.
Usually, DA's say which threading level they support.


Dieter