[mod_python] How to keep globals

Nick nick at dd.revealed.net
Sat Nov 27 13:23:15 EST 2004


On Sat, 2004-11-27 at 12:35 -0500, David Geller wrote:
> Also, since the db connection is never explicitly closed, will it be 
> closed when/if the apache process dies? (mpm = prefork)

Yeah, I wonder that myself.  I've had some flaky results with the mysql
module in the past, specifically keeping connections open that were
supposedly destroyed during garbage collection.  Although, it's not a
bad idea if you're using prefork to register a cleanup handler that
explicitly calls gc.collect() at the end of requests.  There is a
performance hit if you're getting 100s of requests per second, but your
average web app with, say, 50 concurrent users, won't suffer that much.

Nick



More information about the Mod_python mailing list