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