[mod_python] Using shared memory to do global persistence

Jonathan Gardner jgardner at jonathangardner.net
Wed Jun 25 07:32:14 EST 2003

Hash: SHA1

I am thinking of implementing a shared memory module that does more than just 
"read" and "write". Instead, I want something more transparent to the 
developer, so that you say "Go get this dict at this shared memory key" or 
"Create a new dict in shared memory at this key", and have the entire dict 
available like a namespace.

Obvious applications would include the ever-present problem of shared data 
between apache mod_python processes. This would solve it once and for all. 
Perhaps one day we could get it working with RPC and have processes on 
seperate machines sharing data as well.

The scope of this project would be implimenting new types that derive from all 
of the basic types so that:

1) When accessing the data in the type, it would gain a lock on the shared 
memory segment that stores its data using a semaphore, read the data and 
unserialize it, then return that data.
2) When storing the data in that type, it would gain a lock on the shared 
memory segment, then store the data over the existing data.

I am thinking there are really two ways to go about this.
1) Implementing it all in Python. The idea here would be that we would 
serialize and unserialize the data using cPickle.
2) Implementing it all in C. The idea here is that we would reuse the same 
data structures that the basic data types use. We would store and read the 
binary data behind the basic data types so that they can be as easily stored 
in shared memory as they are stored in real memory.

Does anyone know if something like this is implemented or in the process of 
being implemented? Does anyone want to join me in this endeavor? 

- -- 
Jonathan Gardner <jgardner at jonathangardner.net>
(was jgardn at alumni.washington.edu)
Live Free, Use Linux!
Version: GnuPG v1.2.1 (GNU/Linux)


More information about the Mod_python mailing list