logo       

Re: Maximum pool size considered harmful: msg#00079

web.zope.zodb

Subject: Re: Maximum pool size considered harmful

Jeremy Hylton wrote:
One thing I don't understand about the proposal is why the DB keeps weak
references to the connections.

So it can compute cache statistics or allow other connection monitoring tools
to get at existing connections,


> A connection is explicitly opened and
closed.

The terms "open" and "close" are a bit missleading here. Better words
would be "use" and "don't use". "open" implies construction, but
usually, when you open a connection, you may actually get an existing
one. Similarly, "closing" implies destruction, but closing a ZODB connection
may just put it in a pool. This is further complicated by the fact that
the existing implementation partially destroys and reconstructs connections
when they are closed and opened. This code was originally written to avoid
cycles in Python 1.x. This code is very confusing and error prone. A side
agenda in this proposal is to vastly simplify this code. The tear-down that
currently happens in close will go away.


> A weakref is usually used to avoid keeping resources alive
unnecessarily, but the DB can simply drop its (strong) reference to excess
connections when they are closed. Is the proposal intending to make the
close() call optional?

Yes.

> I can't tell why that would be.

Doing so simplifies application code avoids a whole class of bugs. Connections
*should* be able to be garbage collected if application code stops using them.

Applications that don't care about reusing connections needn't bother closing
them.
OTOH, applications that do care, like Zope, will continue to use close.

Jim

--
Jim Fulton mailto:jim@xxxxxxxx Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org


_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list - ZODB-Dev@xxxxxxxx
http://mail.zope.org/mailman/listinfo/zodb-dev



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise