Paul Robinson
paul.robinson at groupbc.com
Wed Jun 11 17:45:17 EST 2003
I'm trying to understand Apache and mod_python in order to understand how to approach the design of some fairly generic concepts with regard to database backed, web front ended applications. Let me start by saying everything I say assumes Apache 2 and mod_python 3.0.3 currently. Apache has a number of modes of operation when it comes to threading and forking, I would like to understand how these things interact with Python subinterpreters [http://www.modpython.org/live/current/doc-html/pyapi-interps.html] and issues such as the Python global interpreter lock (GIL) [http://www.python.org/doc/current/api/threads.html]. For example, on a Windows platform where there is a single multi-threaded Apache process (mpm_wint [http://httpd.apache.org/docs-2.0/mod/mpm_winnt.html]) is it correct to say that mod_python would not be able to take advantage of a multi-processor machine due to the GIL? In another, given Apache running in the prefork MPM [http://httpd.apache.org/docs-2.0/mod/prefork.html]- is it a) possible or b) useful to have a global, per-Apache-process persitant data strucuture sharing a pool of (threadsafe) database connections. I would say not useful since that process will only ever be running a single mod_python request at a time - hence more than one item in the pool would be useless. Given the "worker MPM" [http://httpd.apache.org/docs-2.0/mod/worker.html] however it may be useful but it's not clear to me if it would be possible. Taking the specific example of database connections (let me note I have read and believe I understand FAQ 3.3) is it ever useful or possible to share a pool of database connectors, rather than a single connector in the global namespace. I assume that code such as that in FAQ 3.3 would require additional locking mechanisms in order to function correctly in a multi-threaded Apache environment? I bet there must be some code in existing projects that does stuff like this. Any pointers? Maybe I'm confusing myself at the moment - maybe some other people as well ;-) Thanks in advance, Paul
|