prefork.html.en revision 4db28ee269aa06f7c6232e11cd01f58c3349af23
97a9a944b5887e91042b019776c41d5dd74557aferikabele<?xml version="1.0" encoding="ISO-8859-1"?>
97a9a944b5887e91042b019776c41d5dd74557aferikabele<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
97a9a944b5887e91042b019776c41d5dd74557aferikabele<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive This file is generated from xml source: DO NOT EDIT
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
b686b6a420bde7f78c416b90be11db94cb789979nd -->
b686b6a420bde7f78c416b90be11db94cb789979nd<title>prefork - Apache HTTP Server</title>
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/images/favicon.ico" rel="shortcut icon" /></head>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<body>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<div id="page-header">
b686b6a420bde7f78c416b90be11db94cb789979nd<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>
b686b6a420bde7f78c416b90be11db94cb789979nd<p class="apache">Apache HTTP Server Version 2.3</p>
b686b6a420bde7f78c416b90be11db94cb789979nd<img alt="" src="/images/feather.gif" /></div>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<div id="path">
b686b6a420bde7f78c416b90be11db94cb789979nd<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Modules</a></div>
b686b6a420bde7f78c416b90be11db94cb789979nd<div id="page-content">
b686b6a420bde7f78c416b90be11db94cb789979nd<div id="preamble"><h1>Apache MPM prefork</h1>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<div class="toplang">
b686b6a420bde7f78c416b90be11db94cb789979nd<p><span>Available Languages: </span><a href="/de/mod/prefork.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
b686b6a420bde7f78c416b90be11db94cb789979nd<a href="/en/mod/prefork.html" title="English">&nbsp;en&nbsp;</a> |
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<a href="/ja/mod/prefork.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/tr/mod/prefork.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
0066eddda7203f6345b56f77d146a759298dc635gryzor</div>
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd<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>
f3ec420152ca921e4c1ce77782f51b53f659018dnd<tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr>
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>mpm_prefork_module</td></tr>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>prefork.c</td></tr></table>
b686b6a420bde7f78c416b90be11db94cb789979nd<h3>Summary</h3>
b686b6a420bde7f78c416b90be11db94cb789979nd
b686b6a420bde7f78c416b90be11db94cb789979nd <p>This Multi-Processing Module (MPM) implements a non-threaded,
b686b6a420bde7f78c416b90be11db94cb789979nd pre-forking web server that handles requests in a manner similar
b686b6a420bde7f78c416b90be11db94cb789979nd to Apache 1.3. It is appropriate for sites that need to avoid
b686b6a420bde7f78c416b90be11db94cb789979nd threading for compatibility with non-thread-safe libraries. It
b686b6a420bde7f78c416b90be11db94cb789979nd is also the best MPM for isolating each request, so that a problem
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen with a single request will not affect any other.</p>
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen <p>This MPM is very self-regulating, so it is rarely necessary to
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf adjust its configuration directives. Most important is that
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code> be big enough to
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen handle as many simultaneous requests as you expect to receive, but
b686b6a420bde7f78c416b90be11db94cb789979nd small enough to assure that there is enough physical RAM for all
b686b6a420bde7f78c416b90be11db94cb789979nd processes.</p>
b686b6a420bde7f78c416b90be11db94cb789979nd</div>
b686b6a420bde7f78c416b90be11db94cb789979nd<div id="quickview"><h3 class="directives">Directives</h3>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<ul id="toc">
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#acceptmutex">AcceptMutex</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#coredumpdirectory">CoreDumpDirectory</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#enableexceptionhook">EnableExceptionHook</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mod_unixd.html#group">Group</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#listen">Listen</a></li>
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#listenbacklog">ListenBacklog</a></li>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#lockfile">LockFile</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxclients">MaxClients</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxmemfree">MaxMemFree</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/down.gif" /> <a href="#maxspareservers">MaxSpareServers</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/down.gif" /> <a href="#minspareservers">MinSpareServers</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#pidfile">PidFile</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#receivebuffersize">ReceiveBufferSize</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#scoreboardfile">ScoreBoardFile</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#sendbuffersize">SendBufferSize</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#serverlimit">ServerLimit</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#startservers">StartServers</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/right.gif" /> <a href="mod_unixd.html#user">User</a></li>
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen</ul>
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen<h3>Topics</h3>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf<ul id="topics">
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf<li><img alt="" src="/images/down.gif" /> <a href="#how-it-works">How it Works</a></li>
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen</ul><h3>See also</h3>
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd<ul class="seealso">
e487d6c09669296f94a5190cc34586a98e624a00nd<li><a href="/bind.html">Setting which addresses and ports Apache
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nduses</a></li>
17ade6df5ec233536985eb1c130a906c725dd614humbedooh</ul></div>
e487d6c09669296f94a5190cc34586a98e624a00nd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
b686b6a420bde7f78c416b90be11db94cb789979nd<div class="section">
b686b6a420bde7f78c416b90be11db94cb789979nd<h2><a name="how-it-works" id="how-it-works">How it Works</a></h2>
b686b6a420bde7f78c416b90be11db94cb789979nd <p>A single control process is responsible for launching child
b686b6a420bde7f78c416b90be11db94cb789979nd processes which listen for connections and serve them when they
b686b6a420bde7f78c416b90be11db94cb789979nd arrive. Apache always tries to maintain several <dfn>spare</dfn>
b686b6a420bde7f78c416b90be11db94cb789979nd or idle server processes, which stand ready to serve incoming
b686b6a420bde7f78c416b90be11db94cb789979nd requests. In this way, clients do not need to wait for a new
b686b6a420bde7f78c416b90be11db94cb789979nd child processes to be forked before their requests can be
b686b6a420bde7f78c416b90be11db94cb789979nd served.</p>
b686b6a420bde7f78c416b90be11db94cb789979nd
b686b6a420bde7f78c416b90be11db94cb789979nd <p>The <code class="directive"><a href="/mod/mpm_common.html#startservers">StartServers</a></code>,
b686b6a420bde7f78c416b90be11db94cb789979nd <code class="directive"><a href="#minspareservers">MinSpareServers</a></code>,
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <code class="directive"><a href="#maxspareservers">MaxSpareServers</a></code>, and
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code> regulate how
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd the parent process creates children to serve requests. In general,
e487d6c09669296f94a5190cc34586a98e624a00nd Apache is very self-regulating, so most sites do not need to
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd adjust these directives from their default values. Sites which
17ade6df5ec233536985eb1c130a906c725dd614humbedooh need to serve more than 256 simultaneous requests may need to
e487d6c09669296f94a5190cc34586a98e624a00nd increase <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code>,
b686b6a420bde7f78c416b90be11db94cb789979nd 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
c6e6ef7c81b1ac917bb7a994557908225bac491ecovener thrashing (swapping memory to disk and back). More information
c6e6ef7c81b1ac917bb7a994557908225bac491ecovener about tuning process creation is provided in the <a href="/misc/perf-tuning.html">performance hints</a>
c6e6ef7c81b1ac917bb7a994557908225bac491ecovener documentation.</p>
c6e6ef7c81b1ac917bb7a994557908225bac491ecovener
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <p>While the parent process is usually started as <code>root</code>
c6e6ef7c81b1ac917bb7a994557908225bac491ecovener under Unix in order to bind to port 80, the child processes are
c6e6ef7c81b1ac917bb7a994557908225bac491ecovener launched by Apache as a less-privileged user. The <code class="directive"><a href="/mod/mod_unixd.html#user">User</a></code> and <code class="directive"><a href="/mod/mod_unixd.html#group">Group</a></code> directives are used to set
c6e6ef7c81b1ac917bb7a994557908225bac491ecovener the privileges of the Apache child processes. The child processes
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf must be able to read all the content that will be served, but
c6e6ef7c81b1ac917bb7a994557908225bac491ecovener should have as few privileges beyond that as possible.</p>
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen <p><code class="directive"><a href="/mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code>
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen controls how frequently the server recycles processes by killing
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen old ones and launching new ones.</p>
b686b6a420bde7f78c416b90be11db94cb789979nd</div>
b686b6a420bde7f78c416b90be11db94cb789979nd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
b686b6a420bde7f78c416b90be11db94cb789979nd<div class="directive-section"><h2><a name="MaxSpareServers" id="MaxSpareServers">MaxSpareServers</a> <a name="maxspareservers" id="maxspareservers">Directive</a></h2>
b686b6a420bde7f78c416b90be11db94cb789979nd<table class="directive">
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle child server processes</td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareServers <var>number</var></code></td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxSpareServers 10</code></td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>prefork</td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd</table>
b686b6a420bde7f78c416b90be11db94cb789979nd <p>The <code class="directive">MaxSpareServers</code> directive sets the
fd09dcc9b954fde7abde7955af4ba9a094d34d50rbowen desired maximum number of <em>idle</em> child server processes. An
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd idle process is one which is not handling a request. If there are
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd more than <code class="directive">MaxSpareServers</code> idle, then the
e487d6c09669296f94a5190cc34586a98e624a00nd parent process will kill off the excess processes.</p>
e55e60efce8a3e2139132c1d6ad9f6f0d2976614nd
17ade6df5ec233536985eb1c130a906c725dd614humbedooh <p>Tuning of this parameter should only be necessary on very
e487d6c09669296f94a5190cc34586a98e624a00nd busy sites. Setting this parameter to a large number is almost
b686b6a420bde7f78c416b90be11db94cb789979nd always a bad idea. If you are trying to set the value equal to or lower than
b686b6a420bde7f78c416b90be11db94cb789979nd <code class="directive"><a href="#minspareservers">MinSpareServers</a></code>, Apache
b686b6a420bde7f78c416b90be11db94cb789979nd will automatically adjust it to <code class="directive">MinSpareServers</code><code> + 1</code>.</p>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<h3>See also</h3>
0066eddda7203f6345b56f77d146a759298dc635gryzor<ul>
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd<li><code class="directive"><a href="#minspareservers">MinSpareServers</a></code></li>
f3ec420152ca921e4c1ce77782f51b53f659018dnd<li><code class="directive"><a href="/mod/mpm_common.html#startservers">StartServers</a></code></li>
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung</ul>
727872d18412fc021f03969b8641810d8896820bhumbedooh</div>
0d0ba3a410038e179b695446bb149cce6264e0abnd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
727872d18412fc021f03969b8641810d8896820bhumbedooh<div class="directive-section"><h2><a name="MinSpareServers" id="MinSpareServers">MinSpareServers</a> <a name="minspareservers" id="minspareservers">Directive</a></h2>
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh<table class="directive">
0d0ba3a410038e179b695446bb149cce6264e0abnd<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle child server processes</td></tr>
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareServers <var>number</var></code></td></tr>
727872d18412fc021f03969b8641810d8896820bhumbedooh<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MinSpareServers 5</code></td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>prefork</td></tr>
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh</table>
0d0ba3a410038e179b695446bb149cce6264e0abnd <p>The <code class="directive">MinSpareServers</code> directive sets the
0d0ba3a410038e179b695446bb149cce6264e0abnd desired minimum number of <em>idle</em> child server processes. An
0d0ba3a410038e179b695446bb149cce6264e0abnd idle process is one which is not handling a request. If there are
727872d18412fc021f03969b8641810d8896820bhumbedooh fewer than <code class="directive">MinSpareServers</code> idle, then the parent
0d0ba3a410038e179b695446bb149cce6264e0abnd process creates new children at a maximum rate of 1 per second.</p>
0d0ba3a410038e179b695446bb149cce6264e0abnd
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh <p>Tuning of this parameter should only be necessary on very
1a1356f375e36db7bee379ea0684ab389579f798rbowen busy sites. Setting this parameter to a large number is almost
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen always a bad idea.</p>
0d0ba3a410038e179b695446bb149cce6264e0abnd
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd<h3>See also</h3>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd<ul>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd<li><code class="directive"><a href="#maxspareservers">MaxSpareServers</a></code></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><code class="directive"><a href="/mod/mpm_common.html#startservers">StartServers</a></code></li>
</ul>
</div>
</div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="/de/mod/prefork.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
<a href="/en/mod/prefork.html" title="English">&nbsp;en&nbsp;</a> |
<a href="/ja/mod/prefork.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="/tr/mod/prefork.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 2008 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<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>
</body></html>