prefork.xml revision 08cb74ca432a8c24e39f17dedce527e6a47b8001
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder<?xml version="1.0"?>
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder<!-- $LastChangedRevision$ -->
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder<!--
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder Copyright 2002-2005 The Apache Software Foundation or its licensors, as
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder applicable.
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder Licensed under the Apache License, Version 2.0 (the "License");
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder you may not use this file except in compliance with the License.
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder You may obtain a copy of the License at
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder http://www.apache.org/licenses/LICENSE-2.0
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder Unless required by applicable law or agreed to in writing, software
30203b61afb4393c8e459470b3a16d1fe26acc7fChristian Maeder distributed under the License is distributed on an "AS IS" BASIS,
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30203b61afb4393c8e459470b3a16d1fe26acc7fChristian Maeder See the License for the specific language governing permissions and
f71a8dcf94fd9eb3c9800e16dcdc5e5ff74e5c22Christian Maeder limitations under the License.
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder-->
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder
024621f43239cfe9629e35d35a8669fad7acbba2Christian Maeder<modulesynopsis metafile="prefork.xml.meta">
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder<name>prefork</name>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder<description>Implements a non-threaded, pre-forking web server</description>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder<status>MPM</status>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder<sourcefile>prefork.c</sourcefile>
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder<identifier>mpm_prefork_module</identifier>
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder<summary>
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder <p>This Multi-Processing Module (MPM) implements a non-threaded,
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder pre-forking web server that handles requests in a manner similar
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder to Apache 1.3. It is appropriate for sites that need to avoid
fdbad18e66c0e293f94694458d47df305f050c71Christian Maeder threading for compatibility with non-thread-safe libraries. It
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder is also the best MPM for isolating each request, so that a problem
024621f43239cfe9629e35d35a8669fad7acbba2Christian Maeder with a single request will not affect any other.</p>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder <p>This MPM is very self-regulating, so it is rarely necessary to
ac07a6558423dae7adc488ed9092cd8e9450a29dChristian Maeder adjust its configuration directives. Most important is that
51281dddda866c0cda9fca22bf6bc4eea7128112Christian Maeder <directive module="mpm_common">MaxClients</directive> be big enough to
51281dddda866c0cda9fca22bf6bc4eea7128112Christian Maeder handle as many simultaneous requests as you expect to receive, but
300ce2662e9abb115f7aa4e0a99c172a05ba454dChristian Maeder small enough to assure that there is enough physical RAM for all
ac07a6558423dae7adc488ed9092cd8e9450a29dChristian Maeder processes.</p>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder</summary>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder<seealso><a href="/bind.html">Setting which addresses and ports Apache
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maederuses</a></seealso>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder
319ecaf18256a807f93183b913a2383dfb0e63f2Christian Maeder<section id="how-it-works"><title>How it Works</title>
319ecaf18256a807f93183b913a2383dfb0e63f2Christian Maeder <p>A single control process is responsible for launching child
319ecaf18256a807f93183b913a2383dfb0e63f2Christian Maeder processes which listen for connections and serve them when they
319ecaf18256a807f93183b913a2383dfb0e63f2Christian Maeder arrive. Apache always tries to maintain several <dfn>spare</dfn>
319ecaf18256a807f93183b913a2383dfb0e63f2Christian Maeder or idle server processes, which stand ready to serve incoming
319ecaf18256a807f93183b913a2383dfb0e63f2Christian Maeder requests. In this way, clients do not need to wait for a new
319ecaf18256a807f93183b913a2383dfb0e63f2Christian Maeder child processes to be forked before their requests can be
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder served.</p>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder <p>The <directive module="mpm_common">StartServers</directive>,
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder <directive module="prefork">MinSpareServers</directive>,
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder <directive module="prefork">MaxSpareServers</directive>, and
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder <directive module="mpm_common">MaxClients</directive> regulate how
ac07a6558423dae7adc488ed9092cd8e9450a29dChristian Maeder the parent process creates children to serve requests. In general,
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder Apache is very self-regulating, so most sites do not need to
35c0aa86aea351053f66b9d373148d0bdd4a1fe3Christian Maeder adjust these directives from their default values. Sites which
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder need to serve more than 256 simultaneous requests may need to
35c0aa86aea351053f66b9d373148d0bdd4a1fe3Christian Maeder increase <directive module="mpm_common">MaxClients</directive>,
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder while sites with limited memory may need to decrease <directive
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder module="mpm_common">MaxClients</directive> to keep the server from
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder thrashing (swapping memory to disk and back). More information
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder about tuning process creation is provided in the <a
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder href="/misc/perf-tuning.html">performance hints</a>
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder documentation.</p>
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder <p>While the parent process is usually started as <code>root</code>
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder under Unix in order to bind to port 80, the child processes are
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder launched by Apache as a less-privileged user. The <directive
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder module="mpm_common">User</directive> and <directive
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder module="mpm_common">Group</directive> directives are used to set
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder the privileges of the Apache child processes. The child processes
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder must be able to read all the content that will be served, but
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder should have as few privileges beyond that as possible.</p>
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder <p><directive module="mpm_common">MaxRequestsPerChild</directive>
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder controls how frequently the server recycles processes by killing
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder old ones and launching new ones.</p>
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder</section>
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder<directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
628310b42327ad76ce471caf0dde6563d6fa6307Christian Maeder</directivesynopsis>
f0742398d4587242b1a115de113cd17f63dcb6d0Christian Maeder<directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
f0742398d4587242b1a115de113cd17f63dcb6d0Christian Maeder</directivesynopsis>
f0742398d4587242b1a115de113cd17f63dcb6d0Christian Maeder<directivesynopsis location="mpm_common"><name>PidFile</name>
f0742398d4587242b1a115de113cd17f63dcb6d0Christian Maeder</directivesynopsis>
f0742398d4587242b1a115de113cd17f63dcb6d0Christian Maeder<directivesynopsis location="mpm_common"><name>Listen</name>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder</directivesynopsis>
f71a8dcf94fd9eb3c9800e16dcdc5e5ff74e5c22Christian Maeder<directivesynopsis location="mpm_common"><name>ListenBacklog</name>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder</directivesynopsis>
f71a8dcf94fd9eb3c9800e16dcdc5e5ff74e5c22Christian Maeder<directivesynopsis location="mpm_common"><name>LockFile</name>
c39be436ee9b0c08f9cb0c08988fcf5a5b147db9Christian Maeder</directivesynopsis>
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maeder<directivesynopsis location="mpm_common"><name>MaxClients</name>
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder</directivesynopsis>
f0742398d4587242b1a115de113cd17f63dcb6d0Christian Maeder<directivesynopsis location="mpm_common"><name>MaxMemFree</name>
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder</directivesynopsis>
ac07a6558423dae7adc488ed9092cd8e9450a29dChristian Maeder<directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder</directivesynopsis>
024621f43239cfe9629e35d35a8669fad7acbba2Christian Maeder<directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder</directivesynopsis>
fb69cd512eab767747f109e40322df7cae2f7bdfChristian Maeder<directivesynopsis location="mpm_common"><name>SendBufferSize</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>ServerLimit</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>StartServers</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>User</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>Group</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>AcceptMutex</name>
</directivesynopsis>
<directivesynopsis>
<name>MaxSpareServers</name>
<description>Maximum number of idle child server processes</description>
<syntax>MaxSpareServers <var>number</var></syntax>
<default>MaxSpareServers 10</default>
<contextlist><context>server config</context></contextlist>
<usage>
<p>The <directive>MaxSpareServers</directive> directive sets the
desired maximum number of <em>idle</em> child server processes. An
idle process is one which is not handling a request. If there are
more than <directive>MaxSpareServers</directive> idle, then the
parent process will kill off the excess processes.</p>
<p>Tuning of this parameter should only be necessary on very
busy sites. Setting this parameter to a large number is almost
always a bad idea. If you are trying to set the value equal to or lower than
<directive module="prefork">MinSpareServers</directive>, Apache
will automatically adjust it to <directive
>MinSpareServers</directive><code> + 1</code>.</p>
</usage>
<seealso><directive module="prefork">MinSpareServers</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
</directivesynopsis>
<directivesynopsis>
<name>MinSpareServers</name>
<description>Minimum number of idle child server processes</description>
<syntax>MinSpareServers <var>number</var></syntax>
<default>MinSpareServers 5</default>
<contextlist><context>server config</context></contextlist>
<usage>
<p>The <directive>MinSpareServers</directive> directive sets the
desired minimum number of <em>idle</em> child server processes. An
idle process is one which is not handling a request. If there are
fewer than <directive>MinSpareServers</directive> idle, then the parent
process creates new children at a maximum rate of 1 per second.</p>
<p>Tuning of this parameter should only be necessary on very
busy sites. Setting this parameter to a large number is almost
always a bad idea.</p>
</usage>
<seealso><directive module="prefork">MaxSpareServers</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
</directivesynopsis>
</modulesynopsis>