[mod_python] MemorySession and httpd processes

Jim Gallacher jpg at jgassociates.ca
Fri May 5 20:41:51 EDT 2006


Alexis Marrero wrote:
> Is there anyway that I can use mod_python.Session.MemorySession through 
> the different httpd processes? I guess that the answer is no, but I 
> wanted to check.

You are correct. The answer for anything put mpm-threaded is no.

> I have a process that post data multiple times, one session.
> 
> The problems that I'm having is that httpd instantiate multiple servers 
> by the ServerLimit in hte worker.c module.  Every time apache switches 
> process for handling one of the requests for the requests mod_python 
> believe that the session is not longer valid and creates a new one.
> 
> I had to change my httpd.conf to look like this:
> 
> ###### httpd conf
> 
> # worker MPM
> # StartServers: initial number of server processes to start
> # MaxClients: maximum number of simultaneous client connections
> # MinSpareThreads: minimum number of worker threads which are kept spare
> # MaxSpareThreads: maximum number of worker threads which are kept spare
> # ThreadsPerChild: constant number of worker threads in each server process
> # MaxRequestsPerChild: maximum number of requests a server process serves
> <IfModule worker.c>
> ServerLimit          1
> StartServers         1
> MaxClients          25
> MinSpareThreads     25
> MaxSpareThreads     75
> ThreadsPerChild     25
> MaxRequestsPerChild  0
> </IfModule>
> 
> #######
> 
> In order to force apache to use the same process so the session can be 
> share my multiple threads under the same process.
> 
> But as you can see this limits my number of Process to 1!
 >
> Is there any other more efficient way.
>
> Note that the one of the objects that I need to save in the session 
> CANNOT be pickled.

I think you may be stuck. The only thing I can suggest is to refactor 
your code such that you are able to pickle your data. I realize this is 
not particularly satisfactory.

Jim


More information about the Mod_python mailing list