REPOST: mod_python and threads

Jonathan Gardner jgardn at alumni.washington.edu
Thu Jan 10 17:53:25 EST 2002


On Saturday 29 December 2001 12:32 am, Achim Domma wrote:
> Hi,
>
> I'm playing around with mod_python and I like it, but I don't understand
> how it handles multiple threads. I think apache holds a pool of threads to
> handle request, so what happens if mod_python uses only one subinterpreter
> per virtual server ? Are request handled in a serial way or do I have to
> write threadsafe code ?
>
> could somebody enlighten my please ?
>

Apache spawns a new process called a child. The children handle the requests. 
If you use mod_python, and you have 7 children running, then you have 7 
difference processes who are not related to each other besides the code that 
they hatched from. You will have 7 different instances of python with 7 of 
each module loaded. Just like mod_perl, it may use up a bit more memory, but 
memory is cheap. Programmers aren't.

Jonathan





More information about the Python-list mailing list