[mod_python] Persistent objects in sub-interpreters

Graham Dumpleton graham.dumpleton at gmail.com
Sun Mar 23 23:41:55 EDT 2008


For a start, read:

  http://www.dscpl.com.au/wiki/ModPython/Articles/TheProcessInterpreterModel

So, taking fact that Apache can be multiprocess into account, use
global variables within a module. Best to use a module which can't be
reloaded though. Ie., one on sys.path and not in document tree.

Graham

On 24/03/2008, Sidney Cadot <sidney.cadot at jigsaw.nl> wrote:
> Hi all,
>
>  The whole "raison-d'etre", if you pardon my french, of modpython is to
>  enable persistent (across request) objects like database connections, in
>  order to dramatically improve performance compared to solutions where each
>  request invokes a new interpreter, database connection, etc. At least that's
>  what I gather from the documentation.
>
>  However, I cannot find a documented way of holding objects for reuse between
>  requests to the same Python subinterpreter instance. (Perhaps I just missed
>  it?)
>
>  How is this done? E.g. how would I make a handler that counts the number of
>  invocations of itself by storing an integer in the context of its own
>  sub-interpreter?
>
>  Then, how do I build a persistent database connection on top of that?
>
>  Regards, Sidney
>
>
>
>
>  _______________________________________________
>  Mod_python mailing list
>  Mod_python at modpython.org
>  http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list