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