Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In Ubuntu (and Debian, and other distro) there is a few Apache packages (mpm-event, mpm-prefork, mpm-worker). Which is the most suitable for hosting Django mod_wsgi application on single CPU server? Which package is best choice for OpenVZ container?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

The worker MPM would be your best choice. It's compatible with mod_wsgi. The event MPM might give higher performance, but is far less often used, and any performance improvement is minimal -- hence I won't recommend it. The worker MPM handles each request in a separate thread, which makes it much more suitable for use on a VPS than the traditional prefork model, which uses a whole process for each connection.

share|improve this answer
    
mpm_event has become a much better option for Django in Apache 2.3, and the performance difference between mpm_worker and mpm_event is much larger than expressed in this answer. Every app is different, benchmark! –  robbyt May 28 '12 at 14:55

If you use mod_wsgi daemon mode, it doesn't matter which Apache MPM you use, although suggested that for UNIX systems worker MPM be used unless you are stuck with having to also host PHP applications using mod_php as some PHP extensions aren't thread safe.

The suggestion that you have to have worker MPM in order to use mod_wsgi daemon mode is wrong. What is important is whether the underlying Apache Runtime Library (APR) is built with threading capabilities. This is usually always the case, even if the prefork MPM is being used in Apache. The only systems that don't have threading capabilities built in to APR are older BSD based systems where threading was a bit broken.

share|improve this answer
    
Since I'm still learning more about the subject of the different MPMs and the modes of mod_wsgi, this answer was very helpful to me, especially the first sentence. –  mbaechtold Apr 8 at 11:43

Worker is required if you use mod-wsgi in daemon mode (which I prefer as there are other sites running on my apache server).

If you use mod-wsgi in embedded mode, either is OK.

It's in the docs: http://code.google.com/p/modwsgi/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.