Graham Dumpleton
graham.dumpleton at gmail.com
Fri Mar 14 16:57:51 EDT 2008
On 15/03/2008, Bart <scarfboy at gmail.com> wrote: > On Fri, Mar 14, 2008 at 2:16 PM, Hartmut Fröls <h.froels at web.de> wrote: > > the web, that this is because mod_python opens a new request for > > the call of the PutDat() function and this new interpreter-instance of > > this request has its own global vars. > > Long-lived subinterpreters which handle many requests in their lifetime, > of which there are generally a bunch, and the issue being that you > may or may not land in the same one based on uncontrollable factors, > but close enough. Within a single Apache child process, the same Python sub interpreter would always be used for requests against the same application (unless you override this behaviour). It is a misconception, that doesn't want to go away, that mod_python creates brand new Python sub interpreters for each request against the same process, or that it somehow uses a pool of sub interpreters and ensures that only one request at a time executes in each. Both of these things are totally untrue when applied to a single Apache child process. Where confusion often arises and causes people to wrongly think the things above is that Apache is a multiprocess web server. Thus there can be multiple Apache child processes handling requests concurrently. So, it isn't because there are multiple sub interpreters within the one process, but that the request could be getting handled by a complete different process, containing its own single Python sub interpreter used by that application. Thus, the reason that one can't guarantee a subsequent request goes back to the same sub interpreter is not because it goes to some other sub interpreter in the same process, but that it goes to a completely different process altogether. So, please always make it clear how processes come into the picture else it just propagates wrong notions about how it works. For further information see: http://www.dscpl.com.au/wiki/ModPython/Articles/TheProcessInterpreterModel Graham
|