mpm.html revision 6c0569fdaef723781bbef0b7c8634105a3396b94
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<TITLE>Apache Multi-Processing Modules (MPMs)</TITLE>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster BGCOLOR="#FFFFFF"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster TEXT="#000000"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster LINK="#0000FF"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster VLINK="#000080"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ALINK="#FF0000"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<!--#include virtual="header.html" -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<h1 align="center">Apache Multi-Processing Modules</h1>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<p>The Apache HTTP Server is designed to be a powerful and flexible
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterweb server that can work on a very wide variety of platforms in a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterrange of different environments. Different platforms and different
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterenvironments often require different features, or may have different
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterways of implementing the same feature most efficiently. Apache has
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteralways accommodated a wide variety of environments through its modular
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterdesign. This design allows the webmaster to choose which features
60e9e896a1a7a9e62db162e1e9fb6b3c2df50c33Quentin CASTELwill be included in the server by selecting which modules to load
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostereither at compile-time or at run-time.</p>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<p>Apache 2.0 extends this modular design to the most basic functions
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterof a web server. The server ships with a selection of
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMulti-Processing Modules (MPMs) which are responsible for binding to
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosternetwork ports on the machine, accepting requests, and dispatching
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterchildren to handle the requests.</p>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<p>Extending the modular design to this level of the server
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterallows two important benefits:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<li>Apache can more cleanly and efficiently support a wide variety of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteroperating systems. In particular, the Windows version of Apache is
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosternow much more efficient, since <a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterhref="mod/mpm_winnt.html">mpm_winnt</a> can use native networking
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterfeatures in place of the POSIX layer used in Apache 1.3. This benefit
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteralso extends to other operating systems that implement specialized
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<li>The server can be better customized for the needs of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterparticular site. For example, sites that need a great deal of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterscalability can choose to use a threaded MPM like <a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterhref="mod/threaded.html">threaded</a>, while sites requiring
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterstability or compatibility with older software can use a <a
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterhref="mod/prefork.html">preforking MPM</a>. In addition, special
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterfeatures like serving different hosts under different userids
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster(<a href="mod/perchild.html">perchild</a>) can be provided.</li>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<p>At the user level, MPMs appear much like other Apache modules.
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterThe main difference is that one and only one MPM must be loaded
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterinto the server at any time. The list of available MPMs
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterappears on the <a href="mod/">module index page</a>.</p>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<p>MPMs must be chosen during configuration, and compiled into the server.
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterCompilers are capable of optimizing a lot of functions if threads are used,
60e9e896a1a7a9e62db162e1e9fb6b3c2df50c33Quentin CASTELbut only if they know that threads are being used. Because some MPMs use
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterthreads on Unix and others don't, Apache will always perform better if the
60e9e896a1a7a9e62db162e1e9fb6b3c2df50c33Quentin CASTELMPM is chosen at configuration time and built into Apache.</p>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<p>To actually choose the desired MPM, use the argument --with-mpm=
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<EM>NAME</EM> with the /configure script. <EM>NAME</EM> is the name of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterthe desired MPM.</p>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<p>Once the server has been compiled, it is possible to determine which
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterMPM was chosen by using <code>/httpd -l</code>. This command will list
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterevery module that is compiled into the server, including the MPM.</p>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<!--#include virtual="footer.html" -->