[mod_python] Session data (Sorry for bringing this up again.. .)

Chris Hagner CHagner at fool.com
Tue Jul 3 08:50:12 EST 2001


An alternative would be to have a separate daemon running on the server
(outside of apache/mod_python) that creates/serves/pools/persists your
connections.  Thus, each apache child process/python subinterp would hit
this daemon to get connections.  This model (or something similar) is almost
required if you're going to run apache with many child procs... or multiple
apache instances on the same box.  Either way, you don't really want 100
connections (or more! ack) open to the database.  Heck, if you're running
multiple web servers all hitting a single database, you can easily see how
the total number of connections gets painfully large.  You probably want
something along the lines of 5-10 connections in a db connection pool
(although this is highly dependent on the design of the pool and the
daemon).

Chris

-----Original Message-----
From: Ben Leslie [mailto:benno at sesgroup.net]
Sent: Tuesday, July 03, 2001 2:25 AM
To: Matthew Wood
Cc: mod_python at modpython.org
Subject: Re: [mod_python] Session data (Sorry for bringing this up
again...)


On Tue, 03 Jul 2001, Matthew Wood wrote:

<snip>

>
> This brings me to my question:
> Would  it  be appropriate to keep a database connection in each of the
> memory  spaces?


Yes. This is exactly what I do.

In your handler you have a global variable holding the db connection. In 
the handler you check the db handler is alive and recreate if necessary 
(this should really only happen the first time that process is used)

Benno
_______________________________________________
Mod_python mailing list
Mod_python at modpython.org
http://www.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list