Apache MPMs
From Helpful
| See also Category:Apache. Some of the interesting articles: |
| This article/section is a stub — probably a pile of half-sorted notes and assertions some of which may well be wrong, and not verified as a whole. Feel free to add or refine. |
Note: to avoid confusion with the worker MPM, the word 'actor' is used below in the meaning of 'thing that can handle a request'.
MPM carries the meaning of 'the module that manages the handling of many requests'.
You can write your own MPM, and a bunch of different setups exist.
Most MPMs can create a configurable amount of fixed/total/spare/idle processes or threads, because starting them when things are idle means that when a request comes in it can be immediately assigned, and the latency of actor startup can be avoided.
MPMs can use multiple processes, multiple threads, or both. The best choice depends on your environment (does the OS support forking), code (e.g. threadsafeness), and other requirements.
Non-threaded MPMs include:
- prefork [1]
- multiple processes through forking. Each process is a single worker.
- not available on windows (as fork() is not)
- tries to always a pool that always contains (a configured amount of) idle processes, that can start handling an incoming requests immediately (In busy times it will spawn more (up to min(MaxClients,ServerLimit)(verify)), if many become idle it will kill them off again)}}
- uses more memory than threaded MPMs (because it uses more processes, so more base memory use and loaded modules per worker)
- itk, a derivative of prefork that allows running different vhosts as different users. Available as a diff.
Threaded/hybrid MPMs (hybrid means multiple processes, each multithreaded) include:
- worker
- multi-threaded in multiple processes
- (regularly seen as the alternative to prefork when you want threading)
- winnt [2]
- Default on windows
- multi-threaded in a single process. (so like worker, but limited to a single process that shares all threads. This also means that the one process is not killed unless apache is restarted, a persistence that can be useful as well as bite you)
- netware [3]
- beos [4]
- single control process creating threads for requests
- os2 [5]
- leader (experimental)
- variant of worker;
- threadpool (experimental)
- variant of worker (Not as interesting as worker)
- perchild (experimental)
- not currently functional (you probably want worker)
- multi-threaded in multiple processes
Default MPMs:
- Most unices: prefork
- BeOS, Netware, and OS/2 use their own (beos, mpm_netware, mpmt_os2).
- Windows: mpm_winnt

