[mod_python] Session managment for mod_python

Ben Leslie benno at sesgroup.net
Mon Oct 16 13:35:33 EST 2000

On Sun, 15 Oct 2000, Gregory Trubetskoy wrote:

> On Mon, 16 Oct 2000, Ben Leslie wrote:
> > On Sun, 15 Oct 2000, Gregory Trubetskoy wrote:
> > 
> > > Let me guess - if Apache process is restarted, you would like the state to
> > > be retained througout the restart?
> > 
> > I would count it as dynamic data that can be lost. I am thinking this thing
> > would be great as a cache mainly for expensive database lookups, caching files
> > into memory for faster loading.
> The only example of dynamic data that can be lost that I can think of is
> static, e.g. a list of zipcodes or a cached file, but that doesn't need to
> be shared between apache processes - each process can have its own copy.

This is true but if you have 100 connection you then have 100 times the 
memory. Then again, memory is cheap and programmer time isn't ;)
> On the other hand database lookups are probably a lot cheaper than you
> think. A simple retrival on a keyed table is not all that far from a
> Python dictionary lookup, and most databases will do a great job at
> caching queries in memory.

This is true, and since you can have a persistent connection to the DB for
each thread this works quite well. It is more the expensive functions that 
I've worried about, but again these could be cached on a per thread basis.

> The thing I don't like about databases is that
> Python still lacks a consistent database API like perl's DBI, but that's a
> different issue altogether...

Not entriely true there is the DBAPI from the DB-SIG:

> There *are* some cases where shared memory is a must. In particular,
> things relating to encryption where keys are exchanged at connection
> initiation time. Apache 2.0 addresses those problems, I think there is not
> a lot of sense in trying to solve this on 1.3.... I'd rather spend the
> time porting mod_python to 2.0.

Yep, that makes a lot of sense. I didn't know wether apache 2.0 solved this
or not (and couldn't find the answer after looking at the docs).



More information about the Mod_python mailing list