[mod_python] session data and shared memory

Lex Berezhny LBerezhny at DevIS.com
Sun Jan 12 22:41:12 EST 2003


I would be most interested in this server, if you could find the code
that would be great.

I also took a look at Albatross (from Gregs post) and it contains a
rather simple but elegant session server, similar to what you have
described. If all else fails I will go with that, but I would like to
see your solution first :-)

thanks,

 - lex

On Sun, 2003-01-12 at 21:53, Jeff Stearns wrote:
> I've had good success with a dedicated "session server".  It's a small 
> python server which stores key/value pairs in memory using a Python 
> dictionary.
> 
> Each apache child maintains a persistent TCP connection to the server. 
> It uses a simple RPC protocol to store and fetch key/value pairs. The 
> protocol allows for arbitrary binary data of unlimited size.
> 
> The server ages out stale data after it hasn't been used for a while.
> 
> I also wrote a tiny client-side connection manager in C which handles 
> all the details of making and re-establishing connections.
> 
> I've used this in commercial web sites. Performance is excellent 
> because overhead is so small. (It was originally developed on an 
> ancient SPARC.) I might be able to dig up the source if you're 
> interested, but it's not hard to write your own.
> 
> -jeff stearns
> 
> On Sunday, January 12, 2003, at 05:35 PM, Lex Berezhny wrote:
> 
> > hello,
> >
> > I know the issue of session management has been brought up before, but 
> > I
> > have a more specific question on the topic. Is there a way to keep
> > session state across threads/forked apache processes?
> >
> > Storing the session state in a database carries a lot of overhead since
> > every request requires at least one query.
> >
> > Another solution I had in mind was to use the ZODB with ZEO, so that
> > when a user logs in for example a session object will be created in the
> > ZODB. But this seems like a great deal of hoops just to store a few
> > attributes of session.
> >
> > I have also thought about implementing a very basic LDAP like session
> > registry service. Each mod_python process would open a connection to
> > this registry and be able to share session data with other processes.
> >
> > Has anyone else faced such a problem? Are there any other ways to
> > synchronize data between mod_python instances?
> >
> > thanks in advance,
> >
> >  - lex
> >
> > -- 
> > Lex Berezhny <LBerezhny at DevIS.com>
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
-- 
Lex Berezhny <LBerezhny at DevIS.com>




More information about the Mod_python mailing list