[mod_python] connection pooling?

Mike Looijmans mike.looijmans at asml.com
Fri Apr 11 07:15:59 EST 2003


>is it possible to do connection pooling of database handles in
>mod_python? my understanding is that for the common apache/linux mpm
>(prefork) this amounts to having lots of connections open to the db..

Yes 2x...
Well, "lots" is only relative. Most DBMS won't have a problem with 20 or so
open connections. We're not talking hundreds here...

>i'd like to have a global pool of connections for the server, is this
>possible?


Yes, but the solution below is much simpler.

>somewhat related.. when apache is using the thread mpm, does mod_python
>use a single interpreter for all the threads, or does a different
>interpreter in each thread?

It uses a single interpreter for all threads. Which is quite handy, since you
also share all data, DB connection sharing is a breeze.
However, most DBMSses require you to use a connection per thread, but you can
share a fifo of connections along the threads. That's what I did for MySQL
connections.

--
Mike Looijmans
ASML: http://www5nl.asml.nl/~mlooijma
Private: http://www.milosoftware.com





More information about the Mod_python mailing list