[mod_python] Session data

Bo Lorentsen bl at netgroup.dk
Thu May 31 09:07:33 EST 2001

"G . Sumner Hayes" wrote:

> You can use either shared mmap or SysV shared mem (there are
> python modules for both) to share memory.  I wound up writing
> a Python shared dictionary (just pickles objects into the
> filesystem when you set them, and unpickles them when you read
> them) for my shared state, though I don't share user sessions--I
> share things like parsed template files and other cacheable
> server-side objects that require an expensive calculation the
> first time they're read in.

How about performance ? Is'nt it expensive accessing file in a dir. for shared
data, I mean, you have to reload it if its RW data, or is it write ones read
many (it sounds like it) ?

> Same idea would work for user sessions, and since it's in the
> filesystem the kernel will take care of buffering for you and you
> can use tools like "find" and "rm" to prune the cache. :-)

Hmm, If I like to change user session data offen, I quess I would go for the
"shared mem" solution.

> I agree with Grisha that you probably want to keep state on the
> clients if you can, though.

This is not possible, as  the state, in my case, is a lot of database keys, and
other internal information for navigating a database.


More information about the Mod_python mailing list