[mod_python] sharing stuff between multiple apache processes

Joshua Ginsberg listspam at flowtheory.net
Tue Aug 8 12:37:43 EDT 2006


To talk between processes you need some sort of IPC mechanism. It would
suck if arbitrary processes could share data memory space -- not only
security-wise but locking wise. So no, there is no built-in facility for
this. But you're welcome to try to use some sort of IPC mechanism for
this. Somehow I'm thinking that the overhead of the IPC might be greater
than opening/closing connections.

-jag

On Tue, 2006-08-08 at 12:07 +0200, Julien Cigar wrote:
> Hello list,
> 
> I'm using SQLAlchemy with apache/mod_python (prefork) and a custom 
> mod_python handler. I was looking for a solution to share the SQLAlchemy session 
> object between the apache processes.
> 
> The SQLAlchemy session is almost the same as a session in Hibernate.
> 
> At the moment I have a session object per process (which work fine), but 
> I have to close / reopen the session object for each request which is 
> not optimal ... and can cause a lot of problems if I forget to close the 
> session at the end of a request, for example if I modify an object in 
> the session of a process which is still persistent (cached) in the 
> session of another process, etc ...
> 
> I plan to use either shared memory (no experience with this at the 
> moment) or memcached which look nice. Do you have any suggestion or 
> another solution for this ? 
> Is there something in mod_python to share an object between processes ?
> 
> Thanks,
> Julien
> 
> 



More information about the Mod_python mailing list