Re: Database Connections

Duncan McGreggor <[email protected]> Wed, 4 Aug 2004 21:48:12 -0400
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
On Aug 4, 2004, at 3:46 PM, Sebastien Bigaret wrote:

>
>         Hi Duncan,
>
>   Before answering and since I've never used the mod_python and any of
> its session management tools, could you please tell:
>
> - which session management module you intend to use?
>   (http://www.modpython.org/FAQ/faqw.py?req=all#3.8)

You bet, and sorry about leaving out that detail. We are using 
mod_python 3.1, and using the built-in session management. Here are the 
links:
http://www.modpython.org/live/current/doc-html/pyapi-sess.html
http://www.modpython.org/live/current/doc-html/pyapi-sess-classes.html

> - how does it work? I mean, from a process or thread perspective, can
>   you be more explicit?

Sure; here's a description of how the python interpreter and something 
called "subinterpreters" work in mod_python:
http://www.modpython.org/live/current/doc-html/pyapi-interps.html

I'm no expert on the internals of mod_python, but here's a quick 
run-down of a typical series of steps apache + a simple mod_python 
setup go through during the lifetime of a request:
http://www.modpython.org/live/current/doc-html/tut-what-it-do.html

We've been running a default mod_python apache configuration: 1 main 
process, and multiple child processes are spawned as needed. I don't 
and have never programmed in threads and don't really understand it, so 
you'll have to forgive my terminology, if incorrect...

I guess we could setup mod_python to run a single interpreter 
(http://www.modpython.org/live/current/doc-html/dir-other-pi.html), I 
would want to do that only if we had to though... I think we would 
loose many of the performance gains our client sought by going with 
mod_python in the first place...


> In short, the answer depends on the answer of those questions; the
> EditorContextSessioning component only provides an easy way to register
> and retrieve the EC based on a session id.

Ah... this is good information.

> The number of connection to
> the database is independent to this component, and is usually 1 (one)
> per process (I really mean process here, not threads, a DB connection 
> is
> shared by threads within a single process). That's why I asked about 
> the
> way mod_python + the session management module you'll use handle
> sessions wrt processes.

You're out of my depth here, but I can dig some more if the above info 
doesn't answer these questions...

Thanks!

Duncan



-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com