[mod_python] persistent, reliable globals

Michael C. Neel neel at mediapulse.com
Tue Mar 9 17:52:07 EST 2004


> > > > Perhaps what would be handy: a special python function call, 
> > > > implemented via the API, to allow setting/getting of 
> > objects global 
> > > > to all the forked children for a particular named 
> > interpreter. These 
> > > > objects might be accessible through the req object, for 
> > example. I 
> > > > don't know enough to judge...
> > > >
> > > > Is this feaible? Useful (well, it would be to me...)? Easy/hard?
> > >
> > > Why don't you just use on-disk storage (e.g. anydbm) or a 
> remote db 
> > > for this?  Why reinvent the wheel?
> > 
> > Doesn't this limit you to using pickle-able objects only 
> > then?  There are some important things that don't fall under 
> > this category (e.g. db connections).
> 
> That's what middleware is for.  Again, why reinvent the wheel?
> 
> Best,
> 

Not to beat the horse anymore, but it seems like most of these
db/globals issues could be handled with access to the Apache API
functions for child init and shutdown though mod_python.  One drawback
on not having access to these hooks is that as apache kills children who
hit max requests per child limit python cleans up the memory of that
system, but there is no chance to send a message to other servers that
may need to act as well, such as a db server to know to close a
connection.

Mike



More information about the Mod_python mailing list