prefork.xml revision 5fe85d8662e07bb4e9dbe9c2d0274e90a3058135
55c79512242fd281202cd57ca18defac696440f5kess<?xml version="1.0"?>
55c79512242fd281202cd57ca18defac696440f5kess<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
55c79512242fd281202cd57ca18defac696440f5kess<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
55c79512242fd281202cd57ca18defac696440f5kess<!-- $LastChangedRevision$ -->
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<!--
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd Licensed to the Apache Software Foundation (ASF) under one or more
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd contributor license agreements. See the NOTICE file distributed with
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd this work for additional information regarding copyright ownership.
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd The ASF licenses this file to You under the Apache License, Version 2.0
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd (the "License"); you may not use this file except in compliance with
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd the License. You may obtain a copy of the License at
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd http://www.apache.org/licenses/LICENSE-2.0
27e52281f1522522b170cafc76b08b58aa70ccaand
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd Unless required by applicable law or agreed to in writing, software
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd distributed under the License is distributed on an "AS IS" BASIS,
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4b5981e276e93df97c34e4da05ca5cf8bbd937dand See the License for the specific language governing permissions and
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd limitations under the License.
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd-->
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd<modulesynopsis metafile="prefork.xml.meta">
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end<name>prefork</name>
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end<description>Implements a non-threaded, pre-forking web server</description>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<status>MPM</status>
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd<sourcefile>prefork.c</sourcefile>
55c79512242fd281202cd57ca18defac696440f5kess<identifier>mpm_prefork_module</identifier>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<summary>
55c79512242fd281202cd57ca18defac696440f5kess <p>This Multi-Processing Module (MPM) implements a non-threaded,
55c79512242fd281202cd57ca18defac696440f5kess pre-forking web server that handles requests in a manner similar
55c79512242fd281202cd57ca18defac696440f5kess to Apache 1.3. It is appropriate for sites that need to avoid
1ce7f356a70d1d9961ec315c212e2f83a1452456nd threading for compatibility with non-thread-safe libraries. It
8f057347a12e831fdf567da83de2fa581580298dnd is also the best MPM for isolating each request, so that a problem
5b10fd3977e6dfff19afe770e612e276962f7950nd with a single request will not affect any other.</p>
5b10fd3977e6dfff19afe770e612e276962f7950nd
8f057347a12e831fdf567da83de2fa581580298dnd <p>This MPM is very self-regulating, so it is rarely necessary to
8f057347a12e831fdf567da83de2fa581580298dnd adjust its configuration directives. Most important is that
8f057347a12e831fdf567da83de2fa581580298dnd <directive module="mpm_common">MaxClients</directive> be big enough to
8f057347a12e831fdf567da83de2fa581580298dnd handle as many simultaneous requests as you expect to receive, but
8f057347a12e831fdf567da83de2fa581580298dnd small enough to assure that there is enough physical RAM for all
8f057347a12e831fdf567da83de2fa581580298dnd processes.</p>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd</summary>
5b10fd3977e6dfff19afe770e612e276962f7950nd<seealso><a href="/bind.html">Setting which addresses and ports Apache
5b10fd3977e6dfff19afe770e612e276962f7950nduses</a></seealso>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd
2fc082b48b1bfb1182d6b93f5837e74b0c0af3eckess<section id="how-it-works"><title>How it Works</title>
2fc082b48b1bfb1182d6b93f5837e74b0c0af3eckess <p>A single control process is responsible for launching child
74086452b5093fa1a58446034c6ddfd67dab5651kess processes which listen for connections and serve them when they
74086452b5093fa1a58446034c6ddfd67dab5651kess arrive. Apache always tries to maintain several <dfn>spare</dfn>
de502b36947f981bb79c4b3529b9f9f5edf35b2dkess or idle server processes, which stand ready to serve incoming
de502b36947f981bb79c4b3529b9f9f5edf35b2dkess requests. In this way, clients do not need to wait for a new
b3c7a2279fa7a45f5807d9a404760b9b3760df50nd child processes to be forked before their requests can be
b3c7a2279fa7a45f5807d9a404760b9b3760df50nd served.</p>
8ba890719035fe67c295c9124693138f9c5aa933kess
8ba890719035fe67c295c9124693138f9c5aa933kess <p>The <directive module="mpm_common">StartServers</directive>,
55c79512242fd281202cd57ca18defac696440f5kess <directive module="prefork">MinSpareServers</directive>,
55c79512242fd281202cd57ca18defac696440f5kess <directive module="prefork">MaxSpareServers</directive>, and
8f057347a12e831fdf567da83de2fa581580298dnd <directive module="mpm_common">MaxClients</directive> regulate how
8f057347a12e831fdf567da83de2fa581580298dnd the parent process creates children to serve requests. In general,
8f057347a12e831fdf567da83de2fa581580298dnd Apache is very self-regulating, so most sites do not need to
62664c6703ed9e8d8f4f8e4c5f5e893559ecefecnd adjust these directives from their default values. Sites which
62664c6703ed9e8d8f4f8e4c5f5e893559ecefecnd need to serve more than 256 simultaneous requests may need to
8f057347a12e831fdf567da83de2fa581580298dnd increase <directive module="mpm_common">MaxClients</directive>,
8f057347a12e831fdf567da83de2fa581580298dnd while sites with limited memory may need to decrease <directive
cf60fc8ad0f3a8f4b08351a2a3e346e0662af010nd module="mpm_common">MaxClients</directive> to keep the server from
eac1d56b0c6d54ddf717d035f808bdfa61e8bd14nd thrashing (swapping memory to disk and back). More information
b8670d4ea3a3efcd12c3e1eddf68ef6fabef49fend about tuning process creation is provided in the <a
b8670d4ea3a3efcd12c3e1eddf68ef6fabef49fend href="/misc/perf-tuning.html">performance hints</a>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd documentation.</p>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd
1ce7f356a70d1d9961ec315c212e2f83a1452456nd <p>While the parent process is usually started as <code>root</code>
db99fa79ac42b9cc42b63386eb289aecb0f3cb9cnd under Unix in order to bind to port 80, the child processes are
22d5d84393d960a2027f472036f3fee15d7dbce9nd launched by Apache as a less-privileged user. The <directive
22d5d84393d960a2027f472036f3fee15d7dbce9nd module="mod_unixd">User</directive> and <directive
22d5d84393d960a2027f472036f3fee15d7dbce9nd module="mod_unixd">Group</directive> directives are used to set
5a98f1b67de38575f3903a03fc5120062b814371kess the privileges of the Apache child processes. The child processes
55c79512242fd281202cd57ca18defac696440f5kess must be able to read all the content that will be served, but
55c79512242fd281202cd57ca18defac696440f5kess should have as few privileges beyond that as possible.</p>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess <p><directive module="mpm_common">MaxRequestsPerChild</directive>
55c79512242fd281202cd57ca18defac696440f5kess controls how frequently the server recycles processes by killing
55c79512242fd281202cd57ca18defac696440f5kess old ones and launching new ones.</p>
635e08c1d8332adc365b1c20bbe3577d59ebcd78kess
623eebe956d9c2d6d073ed3eae855b56030b40e9noodl <p>This MPM uses the <code>mpm-accept</code> mutex to serialize
55c79512242fd281202cd57ca18defac696440f5kess access to incoming connections when subject to the thundering herd
55c79512242fd281202cd57ca18defac696440f5kess problem (generally, when there are multiple listening sockets).
ffb88a4885747797937e30a5ac8b1606da3cb4adnd The implementation aspects of this mutex can be configured with the
909ce17e2bd0faef7b1c294f2307f009793fd493nd <directive module="core">Mutex</directive> directive. The <a
55c79512242fd281202cd57ca18defac696440f5kess href="/misc/perf-tuning.html">performance hints</a>
55c79512242fd281202cd57ca18defac696440f5kess documentation has additional information about this mutex.</p>
42af92a661a06b3cebc88d585aad75064a309d51nd</section>
42af92a661a06b3cebc88d585aad75064a309d51nd
ffb88a4885747797937e30a5ac8b1606da3cb4adnd<directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
6fe26506780e73be2a412d758af77fafdf03291and</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>PidFile</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
0203b896e484dfb877111aceffb812401d0f216and<directivesynopsis location="mpm_common"><name>Listen</name>
312d4192f2e32167a1e750034664f1e3c2105c65nd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>ListenBacklog</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>MaxClients</name>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>MaxMemFree</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>ReceiveBufferSize</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
05ede5110427cb9dc071cc671d5aaba5d3b88c79nd<directivesynopsis location="mpm_common"><name>SendBufferSize</name>
e8b603fa9ccf7b17b11b42df6d8916fd97c2331dnd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>ServerLimit</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>StartServers</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mod_unixd"><name>User</name>
611049e38bfbaeb173d2d7fab2e44a48753436a1nd</directivesynopsis>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd<directivesynopsis location="mod_unixd"><name>Group</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<name>MaxSpareServers</name>
d8b761beec42bbe2847bb14e3b706642c6eed47cnd<description>Maximum number of idle child server processes</description>
d8b761beec42bbe2847bb14e3b706642c6eed47cnd<syntax>MaxSpareServers <var>number</var></syntax>
d8b761beec42bbe2847bb14e3b706642c6eed47cnd<default>MaxSpareServers 10</default>
55c79512242fd281202cd57ca18defac696440f5kess<contextlist><context>server config</context></contextlist>
55c79512242fd281202cd57ca18defac696440f5kess
1ce7f356a70d1d9961ec315c212e2f83a1452456nd<usage>
03a4ff9ac4c9b8009249010e7c53bb86ff05915and <p>The <directive>MaxSpareServers</directive> directive sets the
1ce7f356a70d1d9961ec315c212e2f83a1452456nd desired maximum number of <em>idle</em> child server processes. An
55c79512242fd281202cd57ca18defac696440f5kess idle process is one which is not handling a request. If there are
0203b896e484dfb877111aceffb812401d0f216and more than <directive>MaxSpareServers</directive> idle, then the
6329991d5f023c1c4ae02cfbbda636c66e6392aand parent process will kill off the excess processes.</p>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess <p>Tuning of this parameter should only be necessary on very
55c79512242fd281202cd57ca18defac696440f5kess busy sites. Setting this parameter to a large number is almost
55c79512242fd281202cd57ca18defac696440f5kess always a bad idea. If you are trying to set the value equal to or lower than
1ce7f356a70d1d9961ec315c212e2f83a1452456nd <directive module="prefork">MinSpareServers</directive>, Apache
55c79512242fd281202cd57ca18defac696440f5kess will automatically adjust it to <directive
55c79512242fd281202cd57ca18defac696440f5kess >MinSpareServers</directive><code> + 1</code>.</p>
d2b809e5d72658bff23819d8b77f20e4939af541nd</usage>
55c79512242fd281202cd57ca18defac696440f5kess<seealso><directive module="prefork">MinSpareServers</directive></seealso>
cd6c8de3bedcc401ee230159b0439fa20f44488etakashi<seealso><directive module="mpm_common">StartServers</directive></seealso>
55c79512242fd281202cd57ca18defac696440f5kess<seealso><directive module="mpm_common">MaxSpareThreads</directive></seealso>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<name>MinSpareServers</name>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd<description>Minimum number of idle child server processes</description>
c023f60e35022146373e40249f0c8c8d623b6fcfnd<syntax>MinSpareServers <var>number</var></syntax>
27d778df0b517e1578f907d2e51eb961cd8ee5fbjim<default>MinSpareServers 5</default>
27d778df0b517e1578f907d2e51eb961cd8ee5fbjim<contextlist><context>server config</context></contextlist>
27d778df0b517e1578f907d2e51eb961cd8ee5fbjim
a43bfa789f4e52dde53ae8e53fa0427b5c1cf977nd<usage>
a43bfa789f4e52dde53ae8e53fa0427b5c1cf977nd <p>The <directive>MinSpareServers</directive> directive sets the
28c9d384aa958b321280b4ac886941dcad25396bnd desired minimum number of <em>idle</em> child server processes. An
240e1b440b19476ecaa4aa9ff8d79afef74cb14and idle process is one which is not handling a request. If there are
240e1b440b19476ecaa4aa9ff8d79afef74cb14and fewer than <directive>MinSpareServers</directive> idle, then the parent
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi process creates new children at a maximum rate of 1 per second.</p>
e5ce3ac0e9b720c0fa23782e29168a0810697fdetakashi
240e1b440b19476ecaa4aa9ff8d79afef74cb14and <p>Tuning of this parameter should only be necessary on very
240e1b440b19476ecaa4aa9ff8d79afef74cb14and busy sites. Setting this parameter to a large number is almost
240e1b440b19476ecaa4aa9ff8d79afef74cb14and always a bad idea.</p>
240e1b440b19476ecaa4aa9ff8d79afef74cb14and</usage>
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<seealso><directive module="prefork">MaxSpareServers</directive></seealso>
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<seealso><directive module="mpm_common">StartServers</directive></seealso>
55c79512242fd281202cd57ca18defac696440f5kess<seealso><directive module="mpm_common">MinSpareThreads</directive></seealso>
79b024b81f6bb3c44dce77a7552191daf8b522d2jim</directivesynopsis>
79b024b81f6bb3c44dce77a7552191daf8b522d2jim
f772e8f448c223e5ea306f1bf92d97d968f972d5jim</modulesynopsis>
f772e8f448c223e5ea306f1bf92d97d968f972d5jim
fac8c35bfb158112226ab43ddf84d59daca5dc30nd