[mod_python] persistent, reliable globals

Alain Tesio alain at onesite.org
Tue Mar 9 23:28:16 EST 2004


On Tue, 9 Mar 2004 13:46:18 -0800
"Michael S. Fischer" <michael at dynamine.net> wrote:

> > > Why don't you just use on-disk storage (e.g. anydbm) or a remote db 
> > > for this?  Why reinvent the wheel?

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.

Maybe you can look at shared memory, there is a shm module for python,
the problem is that apache processes have their own address space, so you
need a fixed shared memory location with an mmaped file or a shm device,
I'm not sure it will be really faster because you still need to pickle objects.

I don't know a lot about zodb but it may help if it keeps data in cache as
real python objects.

A similar idea is using an object broker like Pyro hosting global objects,
you have local network overhead but no file and no pickling, it may be
really good depending of the type of calls you need (complex global
objects but simple method calls from each process)

The final solution is to have your own multithreaded server and apache
forwarding requests it with proxy directives (like roundup does)

Alain


More information about the Mod_python mailing list