[mod_python] persistant variables

Brian Akey bakey at traq.com
Fri Mar 22 13:53:47 EST 2002


Is there a way to leverage the MM library that people compile in for
mod_ssl?

-----Original Message-----
From: Ian Clelland [mailto:ian at veryfresh.com]
Sent: Friday, March 22, 2002 12:10 PM
To: mod_python at modpython.org
Subject: Re: [mod_python] persistant variables


On Fri, Mar 22, 2002 at 05:18:50PM +0100, Alexander Steinert wrote:
> > How can I force mod_python to only have one instance of the variable? Or
> > should I be trying to do this in an entirely different way?
> > 
> > I can set Apache to only start with one server (which makes it work),
> > however it will spawn more servers if it gets two hits at the same time,
so
> > this won't really work.
> 
> I thought about this topic a few weeks ago and came to the conclusion
> that that you can't force the wished behaviour (if apache is forking).
> 
> You need persistent storage in a DBMS or a file and must take care of
> concurrent accesses.

I've come to the same conclusion myself, after a fair bit of 
experimentation and research (there was a lengthy discussion on this 
list about a year ago: 
http://www.modpython.org/pipermail/mod_python/2001-April/001254.html ).

Because Apache (on Unix) forks new processes for its children, they 
must necessarily run in isolated memory spaces. However, since each 
child process is long-lived, you can retain some persistent data (like 
a database connection handle) between requests /to that child/. It's 
not quite the same thing as global persistent data, but it works for 
some applications.

Apparently mod_perl developers can get around this limitation by using 
the IPC::Shareable module -- has anybody in the Python community done 
any work on something similar?


Ian
<ian at veryfresh.com>
_______________________________________________
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