[mod_python] persistent, reliable globals

Ben ben at medianstrip.net
Tue Mar 9 22:22:56 EST 2004

sleepycat / bsddb3 handles locking automatically.  after setting the
environment, you can use it like a dictionary and it works like magic.

by the way, i'm 99% done with my non-middleware framework that will
plug right into modpython, allow caching db connections, etc.  it
supports programmable caching, right now it can make dynamically
generated pages nearly as fast as plain apache!  i call it
non-middleware because it's super lightweight, and hopefully
unobtrusive.  i will release it as soon as i've sanity checked it all.


On Tue, 9 Mar 2004, Michael S. Fischer wrote:

> Alain Tesio writes:
> > It sounds quite silly to store data on disk to share objects
> > which may not even need to be stored at all, if the point is
> > to have objects in memory and not read/write/pickle/unpickle
> > them all the time and managing locks too.
> When you have a hammer (e.g. pickle), everything looks like a nail, I
> suppose.
> Don't underestimate the power and speed of the filesytem, particularly if
> you're using a decent storage API like Berkeley DB.  Using disk storage
> doesn't have all the drawbacks you might believe.  Most importantly, if
> you're using a modern OS, your performance will be close enough to mmapped
> I/O due to buffer caching.
> Plus you get the benefit of persistence across machine reboots or server
> crashes.
> Besides, coding man-hours are expensive, while RAM and disk is cheap.
> Lock concerns?  Use rename() (safest) or fcntl.flock()/lockf() (can handle
> multiple readers, but not NFS-safe; if you're using NFS, you won't get
> buffer cache benefits anyway, so I don't recommend it).
> --Michael
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list