Nicolas Lehuen
nicolas.lehuen at gmail.com
Thu Dec 15 01:08:38 EST 2005
Note that Apache 2.2 features a database API with connection pooling capabilities. This is all very brand new and bug-prone, but we could imagine building a DBAPI wrapper around this API, thus making it possible to rely on Apache-level pooling mechanisms. See : http://httpd.apache.org/docs/2.1/mod/mod_dbd.html Anyway, this is not a solution in the short term. Regards, Nicolas 2005/12/14, Graham Dumpleton <grahamd at dscpl.com.au>: > > On 15/12/2005, at 12:32 AM, Mike Looijmans wrote: > > >> I've looked at connection pool code for a persistent database > >> connection. I don't know where to create the connection pool. > >> If in the handler code (I'm using publisher), wouldn't a new > >> pool be created each time the handler is called? > >> > > > > You'll get a new pool for each process (not for each thread) > > Technically speaking, not necessarily. :-) > > There will actually be one per Python interpreter instance which uses > that > handler module. Thus if you were supporting two virtual hosts and > both used > the same handler module there would be one for each virtual host in each > process. This even presumes the pool was created at global scope within > the handler module. If it was created within the handler function > itself, then > there could be one per request. > > If pool was created at global scope within the handler module and module > reloading is used, then over time you could end up with multiple > pools with > older ones potentially becoming inaccessible resources with a > resource leak > resulting. Resource pools should ideally be created in modules which are > not the subject of mod_python module reloading. > > All this was what the referenced article and old mailing list posts > help to > describe. > > Graham > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python >
|