]> granicus.if.org Git - apache/blob - docs/manual/mod/prefork.xml
switch to the new format for outdated revision references
[apache] / docs / manual / mod / prefork.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Copyright 2002-2004 The Apache Software Foundation
8
9  Licensed under the Apache License, Version 2.0 (the "License");
10  you may not use this file except in compliance with the License.
11  You may obtain a copy of the License at
12
13      http://www.apache.org/licenses/LICENSE-2.0
14
15  Unless required by applicable law or agreed to in writing, software
16  distributed under the License is distributed on an "AS IS" BASIS,
17  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  See the License for the specific language governing permissions and
19  limitations under the License.
20 -->
21
22 <modulesynopsis metafile="prefork.xml.meta">
23
24 <name>prefork</name>
25 <description>Implements a non-threaded, pre-forking web server</description>
26 <status>MPM</status>
27 <sourcefile>prefork.c</sourcefile>
28 <identifier>mpm_prefork_module</identifier>
29
30 <summary>
31     <p>This Multi-Processing Module (MPM) implements a non-threaded,
32     pre-forking web server that handles requests in a manner similar
33     to Apache 1.3.  It is appropriate for sites that need to avoid
34     threading for compatibility with non-thread-safe libraries.  It
35     is also the best MPM for isolating each request, so that a problem
36     with a single request will not affect any other.</p>
37
38     <p>This MPM is very self-regulating, so it is rarely necessary to
39     adjust its configuration directives.  Most important is that
40     <directive module="mpm_common">MaxClients</directive> be big enough to 
41     handle as many simultaneous requests as you expect to receive, but
42     small enough to assure that there is enough physical RAM for all
43     processes.</p>
44 </summary>
45 <seealso><a href="../bind.html">Setting which addresses and ports Apache
46 uses</a></seealso>
47
48 <section id="how-it-works"><title>How it Works</title>
49     <p>A single control process is responsible for launching child
50     processes which listen for connections and serve them when they
51     arrive. Apache always tries to maintain several <dfn>spare</dfn>
52     or idle server processes, which stand ready to serve incoming
53     requests. In this way, clients do not need to wait for a new
54     child processes to be forked before their requests can be
55     served.</p>
56
57     <p>The <directive module="mpm_common">StartServers</directive>,
58     <directive module="prefork">MinSpareServers</directive>,
59     <directive module="prefork">MaxSpareServers</directive>, and
60     <directive module="mpm_common">MaxClients</directive> regulate how
61     the parent process creates children to serve requests. In general,
62     Apache is very self-regulating, so most sites do not need to
63     adjust these directives from their default values. Sites which
64     need to serve more than 256 simultaneous requests may need to
65     increase <directive module="mpm_common">MaxClients</directive>,
66     while sites with limited memory may need to decrease <directive
67     module="mpm_common">MaxClients</directive> to keep the server from
68     thrashing (swapping memory to disk and back). More information
69     about tuning process creation is provided in the <a
70     href="../misc/perf-tuning.html">performance hints</a>
71     documentation.</p>
72
73     <p>While the parent process is usually started as <code>root</code>
74     under Unix in order to bind to port 80, the child processes are
75     launched by Apache as a less-privileged user. The <directive
76     module="mpm_common">User</directive> and <directive
77     module="mpm_common">Group</directive> directives are used to set
78     the privileges of the Apache child processes. The child processes
79     must be able to read all the content that will be served, but
80     should have as few privileges beyond that as possible.</p>
81
82     <p><directive module="mpm_common">MaxRequestsPerChild</directive>
83     controls how frequently the server recycles processes by killing
84     old ones and launching new ones.</p>
85 </section>
86
87 <directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
88 </directivesynopsis>
89 <directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
90 </directivesynopsis>
91 <directivesynopsis location="mpm_common"><name>PidFile</name>
92 </directivesynopsis>
93 <directivesynopsis location="mpm_common"><name>Listen</name>
94 </directivesynopsis>
95 <directivesynopsis location="mpm_common"><name>ListenBacklog</name>
96 </directivesynopsis>
97 <directivesynopsis location="mpm_common"><name>LockFile</name>
98 </directivesynopsis>
99 <directivesynopsis location="mpm_common"><name>MaxClients</name>
100 </directivesynopsis>
101 <directivesynopsis location="mpm_common"><name>MaxMemFree</name>
102 </directivesynopsis>
103 <directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
104 </directivesynopsis>
105 <directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
106 </directivesynopsis>
107 <directivesynopsis location="mpm_common"><name>SendBufferSize</name>
108 </directivesynopsis>
109 <directivesynopsis location="mpm_common"><name>ServerLimit</name>
110 </directivesynopsis>
111 <directivesynopsis location="mpm_common"><name>StartServers</name>
112 </directivesynopsis>
113 <directivesynopsis location="mpm_common"><name>User</name>
114 </directivesynopsis>
115 <directivesynopsis location="mpm_common"><name>Group</name>
116 </directivesynopsis>
117 <directivesynopsis location="mpm_common"><name>AcceptMutex</name>
118 </directivesynopsis>
119
120 <directivesynopsis>
121 <name>MaxSpareServers</name>
122 <description>Maximum number of idle child server processes</description>
123 <syntax>MaxSpareServers <var>number</var></syntax>
124 <default>MaxSpareServers 10</default>
125 <contextlist><context>server config</context></contextlist>
126
127 <usage>
128     <p>The <directive>MaxSpareServers</directive> directive sets the
129     desired maximum number of <em>idle</em> child server processes. An
130     idle process is one which is not handling a request. If there are
131     more than <directive>MaxSpareServers</directive> idle, then the
132     parent process will kill off the excess processes.</p>
133
134     <p>Tuning of this parameter should only be necessary on very
135     busy sites. Setting this parameter to a large number is almost
136     always a bad idea. If you are trying to set the value equal to or lower than
137     <directive module="prefork">MinSpareServers</directive>, Apache
138     will automatically adjust it to <directive
139     >MinSpareServers</directive><code> + 1</code>.</p>
140 </usage>
141 <seealso><directive module="prefork">MinSpareServers</directive></seealso>
142 <seealso><directive module="mpm_common">StartServers</directive></seealso>
143 </directivesynopsis>
144
145 <directivesynopsis>
146 <name>MinSpareServers</name>
147 <description>Minimum number of idle child server processes</description>
148 <syntax>MinSpareServers <var>number</var></syntax>
149 <default>MinSpareServers 5</default>
150 <contextlist><context>server config</context></contextlist>
151
152 <usage>
153     <p>The <directive>MinSpareServers</directive> directive sets the
154     desired minimum number of <em>idle</em> child server processes. An
155     idle process is one which is not handling a request. If there are
156     fewer than <directive>MinSpareServers</directive> idle, then the parent
157     process creates new children at a maximum rate of 1 per second.</p>
158
159     <p>Tuning of this parameter should only be necessary on very
160     busy sites. Setting this parameter to a large number is almost
161     always a bad idea.</p>
162 </usage>
163 <seealso><directive module="prefork">MaxSpareServers</directive></seealso>
164 <seealso><directive module="mpm_common">StartServers</directive></seealso>
165 </directivesynopsis>
166
167 </modulesynopsis>
168