prefork.html.en revision a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers This file is generated from xml source: DO NOT EDIT
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<link href="/images/favicon.ico" rel="shortcut icon" /></head>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<p class="apache">Apache HTTP Server Version 2.1</p>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.1</a> > <a href="./">Modules</a></div>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Implements a non-threaded, pre-forking web server</td></tr>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>mpm_prefork_module</td></tr>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>prefork.c</td></tr></table>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers <p>This Multi-Processing Module (MPM) implements a non-threaded,
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers pre-forking web server that handles requests in a manner similar
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek to Apache 1.3. It is appropriate for sites that need to avoid
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek threading for compatibility with non-thread-safe libraries. It
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek is also the best MPM for isolating each request, so that a problem
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek with a single request will not affect any other.</p>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek <p>This MPM is very self-regulating, so it is rarely necessary to
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek adjust its configuration directives. Most important is that
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code> be big enough to
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek handle as many simultaneous requests as you expect to receive, but
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers small enough to assure that there is enough physical RAM for all
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers processes.</p>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<div id="quickview"><h3 class="directives">Directives</h3>
24a4501d70e60f15c074e9f5bda46a7fbc5735e5Peter Hutterer<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#acceptmutex">AcceptMutex</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#bs2000account">BS2000Account</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#coredumpdirectory">CoreDumpDirectory</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#group">Group</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#listen">Listen</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#listenbacklog">ListenBacklog</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#lockfile">LockFile</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxclients">MaxClients</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxmemfree">MaxMemFree</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/down.gif" /> <a href="#maxspareservers">MaxSpareServers</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/down.gif" /> <a href="#minspareservers">MinSpareServers</a></li>
fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54Zbigniew Jędrzejewski-Szmek<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#pidfile">PidFile</a></li>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#scoreboardfile">ScoreBoardFile</a></li>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#sendbuffersize">SendBufferSize</a></li>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#serverlimit">ServerLimit</a></li>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#startservers">StartServers</a></li>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#user">User</a></li>
b534166eaec8fef9902a68f75cab8eeae458b23cMartin Pitt<li><img alt="" src="/images/down.gif" /> <a href="#how-it-works">How it Works</a></li>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<li><a href="/bind.html">Setting which addresses and ports Apache
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<h2><a name="how-it-works" id="how-it-works">How it Works</a></h2>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers <p>A single control process is responsible for launching child
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers processes which listen for connections and serve them when they
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers arrive. Apache always tries to maintain several <dfn>spare</dfn>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers or idle server processes, which stand ready to serve incoming
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers requests. In this way, clients do not need to wait for a new
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers child processes to be forked before their requests can be
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers <p>The <code class="directive"><a href="/mod/mpm_common.html#startservers">StartServers</a></code>,
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers <code class="directive"><a href="#minspareservers">MinSpareServers</a></code>,
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers <code class="directive"><a href="#maxspareservers">MaxSpareServers</a></code>, and
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code> regulate how
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers the parent process creates children to serve requests. In general,
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers Apache is very self-regulating, so most sites do not need to
42a9de1c2513aa348df369080cdd941ef4ab00abMartin Pitt adjust these directives from their default values. Sites which
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers need to serve more than 256 simultaneous requests may need to
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt increase <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code>,
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt while sites with limited memory may need to decrease <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code> to keep the server from
90e633a7901060063e62bf53948c4c239a9f55d1Jason St. John thrashing (swapping memory to disk and back). More information
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt about tuning process creation is provided in the <a href="/misc/perf-tuning.html">performance hints</a>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt documentation.</p>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt <p>While the parent process is usually started as <code>root</code>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt under Unix in order to bind to port 80, the child processes are
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt launched by Apache as a less-privileged user. The <code class="directive"><a href="/mod/mpm_common.html#user">User</a></code> and <code class="directive"><a href="/mod/mpm_common.html#group">Group</a></code> directives are used to set
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt the privileges of the Apache child processes. The child processes
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt must be able to read all the content that will be served, but
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt should have as few privileges beyond that as possible.</p>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt <p><code class="directive"><a href="/mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt controls how frequently the server recycles processes by killing
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt old ones and launching new ones.</p>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt<div class="directive-section"><h2><a name="MaxSpareServers" id="MaxSpareServers">MaxSpareServers</a> <a name="maxspareservers" id="maxspareservers">Directive</a></h2>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle child server processes</td></tr>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareServers <var>number</var><br /></code></td></tr>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxSpareServers 10</code></td></tr>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>prefork</td></tr>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt <p>The <code class="directive">MaxSpareServers</code> directive sets the
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt desired maximum number of <em>idle</em> child server processes. An
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt idle process is one which is not handling a request. If there are
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt more than <code class="directive">MaxSpareServers</code> idle, then the
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt parent process will kill off the excess processes.</p>
c5b7838ddeae1fcd5c613ea15f04918b945823e5Martin Pitt <p>Tuning of this parameter should only be necessary on very
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers busy sites. Setting this parameter to a large number is almost
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers always a bad idea. If you are trying to set the value lower than
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers <code class="directive"><a href="#minspareservers">MinSpareServers</a></code>, Apache
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers will automatically adjust it to <code class="directive">MinSpareServers</code><code> + 1</code>.</p>
b534166eaec8fef9902a68f75cab8eeae458b23cMartin Pitt<li><code class="directive"><a href="#minspareservers">MinSpareServers</a></code></li>
2dd30e7da94b32df03451df8cf602e9454a376cbKay Sievers<li><code class="directive"><a href="/mod/mpm_common.html#startservers">StartServers</a></code></li>
1e091c1285b59d0fbab58e6e5113ad111bc08794Martin Pitt<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
1e091c1285b59d0fbab58e6e5113ad111bc08794Martin Pitt<div class="directive-section"><h2><a name="MinSpareServers" id="MinSpareServers">MinSpareServers</a> <a name="minspareservers" id="minspareservers">Directive</a></h2>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle child server processes</td></tr>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareServers <var>number</var></code></td></tr>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MinSpareServers 5</code></td></tr>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>prefork</td></tr>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers <p>The <code class="directive">MinSpareServers</code> directive sets the
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers desired minimum number of <em>idle</em> child server processes. An
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers idle process is one which is not handling a request. If there are
ee2babf4c36f9ab65e9ebbe966ed7839c532df45Martin Pitt fewer than <code class="directive">MinSpareServers</code> idle, then the parent
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers process creates new children at a maximum rate of 1 per second.</p>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers <p>Tuning of this parameter should only be necessary on very
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers busy sites. Setting this parameter to a large number is almost
33e74db2667103e33f7e47277378612dcdbdfaa5Martin Pitt always a bad idea.</p>
33e74db2667103e33f7e47277378612dcdbdfaa5Martin Pitt<li><code class="directive"><a href="#maxspareservers">MaxSpareServers</a></code></li>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<li><code class="directive"><a href="/mod/mpm_common.html#startservers">StartServers</a></code></li>
aedc2eddd16e48d468e6ad0aea2caf00c7d37365Kay Sievers<p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
0c959b39175b126fdb70ae00de37ca6d9c8ca3a1Kay Sievers<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>