8

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?

3 Answers 3

3

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.

2
  • 1
    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, 2012 at 14:55
  • seconded for the mpm_event. "far less often used" is because the above comment is from 2009, and all MPMs are compatible with mod_wsgi daemon mode.
    – zzzeek
    Jul 13, 2017 at 20:21
13

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.

1
  • 1
    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, 2014 at 11:43
0

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/

1
  • where it says that worker mpm is required for mod-wsgi? Aug 27, 2020 at 6:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .