Pregunta

I have a django application which relies heavily on threading and I'm noticing no performance increment no matter how much processes or threads I add to the WSGIDaemonProcess.

I can't find a YES/NO answer out there and I'm wondering. Could it be that mod_wsgi is using the same interpreter for each request so I'm running in a bottleneck due to a GIL limitation?

If so, would you recommend something else that would help me workaround this limitation?

¿Fue útil?

Solución

For a typical configuration, yes, all requests would be handle in same sub interpreter.

If in different sub interpreters of same process, you are still affected by the GIL.

Post your actual mod_wsgi configuration to confirm you have set things up right.

Consider trying New Relic to find out where real bottlenecks are.

Watch my PyCon US 2012 talk on finding bottlenecks

Otros consejos

Short answer:

No.

Long answer:

This ability to make good use of more than processor, even when using multithreading, is further enchanced by the fact that Apache uses multiple processes for handling requests and not just a single process. Thus, even when there is some contention for the GIL within a specific process, it doesn't stop other processes from being able to run as the GIL is only local to a process and does not extend across processes.

Citation: https://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

You haven't given enough information for anybody to recommend how to improve performance, but if you've actually written a thread-heavy program in Python, that's your first mistake. Instead of running your program on CPython, maybe you should try Jython or IronPython instead. But then it wouldn't work with mod_wsgi, so we really need more details to understand what you're trying to do...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top