[mod_python] Persistent objects in sub-interpreters

Clodoaldo clodoaldo.pinto.neto at gmail.com
Mon Mar 24 06:30:01 EDT 2008

2008/3/23, Sidney Cadot <sidney.cadot at jigsaw.nl>:
> 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?

If you are using postgresql consider Pgpool. It is very easy to setup,
it will serve connections to any language not only Python and the most
important, you don't have to worry about your own implementation of
persistent connections.

Regards, Clodoaldo Pinto Neto

More information about the Mod_python mailing list