When developing a Django application deployed on Apache mod_wsgi, I found that in the case of multithreading (Python threads, mod_wsgi processes = 1 threads = 8), Python will not use all available processors. Thanks to the multiprocessor approach (mod_wsgi processes = 8 threads = 1) everything is in order, and I can fully load my machine.
So the question is: is this Python behavior normal? I doubt it because using 1 process with multiple threads is the standard mod_wsgi method.
System:
2xIntel Xeon 5XXX series (8 cores (16 with hyper-thread)) on FreeBSD 7.2 AMD64 and Python 2.6.4
Thanks to everyone for the answers. We all found that this behavior is normal due to the GIL. Here is a good explanation: http://jessenoller.com/2009/02/01/python-threads-and-the-global-interpreter-lock/ or stackoverflow. GIL talk: What is global interpreter lock (GIL)? .
performance python multithreading django multiprocessing
Hardquestions
source share