[mod_python] Best practise for database connection pooling?

Simon Willison cs1spw at bath.ac.uk
Fri Sep 5 03:42:29 EST 2003

We are looking to build a large content management system using 
mod_python and PostgreSQL. I'm interested in what is considered "best 
practise" for database connection pooling. So far, I've been playing 
with the idea of setting up a single database connection as a global 
variable at the start of each mod_python script - since scripts stay in 
memory between requests, this can be reused for requests without needing 
to reopen the connection. It also means that every httpd child process 
spun off by the server ends up with its own database connection.

The postgres server is running on the same machine as the web server, 
but we may move to separate servers for the two in the future. Am I on 
the right track, or is there a better way of managing database connnections?

Incidentally, the database connection module we are using is 


Simon Willison

More information about the Mod_python mailing list