[Zope-dev] Re: SQLAlchemy integration experiment

Michael Bayer mike_mp at zzzcomputing.com
Tue Jun 17 13:21:04 EDT 2008


On Jun 17, 2008, at 12:41 PM, Laurence Rowe wrote:

>
> What connection pooling is used by default? e.g. with
> create_engine('sqlite:///:memory:')

sqlite is a special case, it uses the SingletonThreadPool.  This pool  
holds onto one connection per thread.    This is used in SQLite  
because of a sometimes-restriction that a sqlite connection can only  
be used in the same thread in which it was created.  The pool in  
normal use is QueuePool.

> I think we are only talking about the difference between using four
> pools of one connection versus one pool of four connections (assuming
> the standard four threads in zope). I don't see that making a lot of
> difference in practice.

in practice, a single pool of four connections means if one of those  
connections encounters a "connection lost" exception, the exception is  
raised, and the entire pool is recycled; meaning that only one  
exception is raised for the whole application during a database  
restart.   It also means that the total connections used by the  
application for a particular database can be configured/throttled in  
one place.   To me thats a significant difference.



More information about the Zope-Dev mailing list