]> granicus.if.org Git - apache/blob - docs/manual/mod/mpm_common.html.en
move es and fr targets to *.utf8 extension. Update transformation
[apache] / docs / manual / mod / mpm_common.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
4 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
5 <!--
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7               This file is generated from xml source: DO NOT EDIT
8         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9       -->
10 <title>mpm_common - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
15 </script>
16
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
18 <body>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.png" /></div>
23 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
24 <div id="path">
25 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache MPM Common Directives</h1>
28 <div class="toplang">
29 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
30 <a href="../en/mod/mpm_common.html" title="English">&nbsp;en&nbsp;</a> |
31 <a href="../fr/mod/mpm_common.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
32 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
33 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
34 </div>
35 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>A collection of directives that are implemented by
36 more than one multi-processing module (MPM)</td></tr>
37 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr></table>
38 </div>
39 <div id="quickview"><h3 class="directives">Directives</h3>
40 <ul id="toc">
41 <li><img alt="" src="../images/down.gif" /> <a href="#accepterrorsnonfatal">AcceptErrorsNonFatal</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#coredumpdirectory">CoreDumpDirectory</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#enableexceptionhook">EnableExceptionHook</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#gracefulshutdowntimeout">GracefulShutdownTimeout</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#listen">Listen</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#listenbacklog">ListenBackLog</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#listencoresbucketsratio">ListenCoresBucketsRatio</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#maxconnectionsperchild">MaxConnectionsPerChild</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#maxmemfree">MaxMemFree</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#maxrequestworkers">MaxRequestWorkers</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#maxsparethreads">MaxSpareThreads</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#minsparethreads">MinSpareThreads</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#pidfile">PidFile</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#receivebuffersize">ReceiveBufferSize</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#scoreboardfile">ScoreBoardFile</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#sendbuffersize">SendBufferSize</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#serverlimit">ServerLimit</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#startservers">StartServers</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#startthreads">StartThreads</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#threadlimit">ThreadLimit</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#threadsperchild">ThreadsPerChild</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#threadstacksize">ThreadStackSize</a></li>
63 </ul>
64 <h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component=mpm_common">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component=mpm_common">Report a bug</a></li></ul><h3>See also</h3>
65 <ul class="seealso">
66 <li><a href="#comments_section">Comments</a></li></ul></div>
67
68 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
69 <div class="directive-section"><h2><a name="AcceptErrorsNonFatal" id="AcceptErrorsNonFatal">AcceptErrorsNonFatal</a> <a name="accepterrorsnonfatal" id="accepterrorsnonfatal">Directive</a><a title="Permanent link" href="#accepterrorsnonfatal" class="permalink">&para;</a></h2>
70 <table class="directive">
71 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Treat some errors accepting a new connection as non-fatal
72 to the httpd process.</td></tr>
73 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptErrorsNonFatal ON</code></td></tr>
74 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>OFF (ECONNREFUSED, ECONNABORTED, ECONNRESET cause the process to 
75          exit)</code></td></tr>
76 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
77 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
78 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
79 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.5.1 and later</td></tr>
80 </table>
81     <p>The <code class="directive">AcceptErrorsNonFatal</code> alters the servers
82     behavior under some rare errors that may occur while accepting a new 
83     client connection.  By default, the child process handling a request
84     will gracefully exit when nearly any socket error occurs during the
85     accept() system call.  This is to ensure a potentially unhealthy
86     child process does not try to take on more new connections.</p>
87
88     <p>With <code class="directive">AcceptErrorsNonFatal</code> set to "ON",
89     the process will <em>not</em> begin to exit if the accept() error is
90     ECONNREFUSED, ECONNABORTED, or ECONNRESET.</p>
91  
92     <div class="note">Some third-party firwewall software components may inject errors
93     into accept() processing, using return codes not specified by the 
94     operating system</div>
95
96 </div>
97 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
98 <div class="directive-section"><h2><a name="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">Directive</a><a title="Permanent link" href="#coredumpdirectory" class="permalink">&para;</a></h2>
99 <table class="directive">
100 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory where Apache HTTP Server attempts to
101 switch before dumping core</td></tr>
102 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CoreDumpDirectory <var>directory</var></code></td></tr>
103 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for the default setting</code></td></tr>
104 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
105 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
106 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
107 </table>
108     <p>This controls the directory to which Apache httpd attempts to
109     switch before dumping core. If your operating system is configured to
110     create core files in the working directory of the crashing process,
111     <code class="directive">CoreDumpDirectory</code> is necessary to change working
112     directory from the default <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>
113     directory, which should not be writable by the user the server runs as.</p>
114
115     <p>If you want a core dump for debugging, you can use this directive to
116     place it in a different location. This directive has no effect if your
117     operating system is not configured to write core files to the working directory
118     of the crashing processes.</p>
119
120     <div class="note"><h3>Core Dumps on Linux</h3>
121       <p>If Apache httpd starts as root and switches to another user, the
122       Linux kernel <em>disables</em> core dumps even if the directory is
123       writable for the process. Apache httpd (2.0.46 and later) reenables core dumps
124       on Linux 2.4 and beyond, but only if you explicitly configure a <code class="directive">CoreDumpDirectory</code>.</p>
125     </div>
126
127     <div class="note">
128     <h3>Core Dumps on BSD</h3>
129     <p>To enable core-dumping of suid-executables on BSD-systems (such
130     as FreeBSD), set <code>kern.sugid_coredump</code> to 1.
131     </p>
132     </div>
133
134     <div class="note"><h3>Specific signals</h3>
135       <p><code class="directive">CoreDumpDirectory</code> processing only occurs for
136       a select set of fatal signals: SIGFPE, SIGILL, SIGABORT,
137       SIGSEGV, and SIGBUS.</p>
138       <p>On some operating systems, SIGQUIT also results in a core dump but
139       does not go through <code class="directive">CoreDumpDirectory</code> or
140       <code class="directive">EnableExceptionHook</code> processing, so the core
141       location is dictated entirely by the operating system.</p>
142     </div>
143
144
145 </div>
146 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
147 <div class="directive-section"><h2><a name="EnableExceptionHook" id="EnableExceptionHook">EnableExceptionHook</a> <a name="enableexceptionhook" id="enableexceptionhook">Directive</a><a title="Permanent link" href="#enableexceptionhook" class="permalink">&para;</a></h2>
148 <table class="directive">
149 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables a hook that runs exception handlers
150 after a crash</td></tr>
151 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableExceptionHook On|Off</code></td></tr>
152 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableExceptionHook Off</code></td></tr>
153 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
154 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
155 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
156 </table>
157     <p>For safety reasons this directive is only available if the server was
158     configured with the <code>--enable-exception-hook</code> option. It
159     enables a hook that allows external modules to plug in and do something
160     after a child crashed.</p>
161
162     <p>There are already two modules, <code>mod_whatkilledus</code> and
163     <code>mod_backtrace</code> that make use of this hook. Please have a
164     look at Jeff Trawick's <a href="https://emptyhammock.com/projects/httpd/diag/">EnableExceptionHook site</a> for more information about these.</p>
165
166 </div>
167 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
168 <div class="directive-section"><h2><a name="GracefulShutdownTimeout" id="GracefulShutdownTimeout">GracefulShutdownTimeout</a> <a name="gracefulshutdowntimeout" id="gracefulshutdowntimeout">Directive</a><a title="Permanent link" href="#gracefulshutdowntimeout" class="permalink">&para;</a></h2>
169 <table class="directive">
170 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify a timeout after which a gracefully shutdown server
171 will exit.</td></tr>
172 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GracefulShutdownTimeout <var>seconds</var></code></td></tr>
173 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>GracefulShutdownTimeout 0</code></td></tr>
174 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
175 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
176 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
177 </table>
178     <p>The <code class="directive">GracefulShutdownTimeout</code> specifies
179     how many seconds after receiving a "graceful-stop" signal, a
180     server should continue to run, handling the existing connections.</p>
181
182     <p>Setting this value to zero means that the server will wait
183     indefinitely until all remaining requests have been fully served.</p>
184
185 </div>
186 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
187 <div class="directive-section"><h2><a name="Listen" id="Listen">Listen</a> <a name="listen" id="listen">Directive</a><a title="Permanent link" href="#listen" class="permalink">&para;</a></h2>
188 <table class="directive">
189 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>IP addresses and ports that the server
190 listens to</td></tr>
191 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Listen [<var>IP-address</var>:]<var>portnumber</var> [<var>protocol</var>]</code></td></tr>
192 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
193 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
194 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
195 </table>
196     <p>The <code class="directive">Listen</code> directive instructs Apache httpd to
197     listen to only specific IP addresses or ports; by default it
198     responds to requests on all IP interfaces. <code class="directive">Listen</code>
199     is now a required directive. If it is not in the config file, the
200     server will fail to start. This is a change from previous versions
201     of Apache httpd.</p>
202
203     <p>The <code class="directive">Listen</code> directive tells the server to
204     accept incoming requests on the specified port or address-and-port
205     combination. If only a port number is specified, the server listens to
206     the given port on all interfaces. If an IP address is given as well
207     as a port, the server will listen on the given port and
208     interface.</p>
209
210     <p>Multiple <code class="directive">Listen</code> directives may be used to
211     specify a number of addresses and ports to listen to. The server will
212     respond to requests from any of the listed addresses and ports.</p>
213
214     <p>For example, to make the server accept connections on both
215     port 80 and port 8000, use:</p>
216
217     <pre class="prettyprint lang-config">Listen 80
218 Listen 8000</pre>
219
220
221     <p>To make the server accept connections on two specified
222     interfaces and port numbers, use </p>
223
224     <pre class="prettyprint lang-config">Listen 192.170.2.1:80
225 Listen 192.170.2.5:8000</pre>
226
227
228     <p>IPv6 addresses must be surrounded in square brackets, as in the
229     following example:</p>
230
231     <pre class="prettyprint lang-config">Listen [2001:db8::a00:20ff:fea7:ccea]:80</pre>
232
233
234     <p>The optional <var>protocol</var> argument is not required for most
235        configurations. If not specified, <code>https</code> is the default for
236        port 443 and <code>http</code> the default for all other ports.  The
237        protocol is used to determine which module should handle a request, and
238        to apply protocol specific optimizations with the
239        <code class="directive"><a href="../mod/core.html#acceptfilter">AcceptFilter</a></code> directive.</p>
240
241     <p>You only need to set the protocol if you are running on non-standard
242        ports.  For example, running an <code>https</code> site on port 8443:</p>
243
244     <pre class="prettyprint lang-config">Listen 192.170.2.1:8443 https</pre>
245
246
247     <div class="note"><h3>Error condition</h3>
248       Multiple <code class="directive">Listen</code> directives for the same ip
249       address and port will result in an <code>Address already in use</code>
250       error message.
251     </div>
252
253
254 <h3>See also</h3>
255 <ul>
256 <li><a href="../dns-caveats.html">DNS Issues</a></li>
257 <li><a href="../bind.html">Setting which addresses and ports Apache HTTP Server
258     uses</a></li>
259 <li><a href="http://wiki.apache.org/httpd/CouldNotBindToAddress">Further
260 discussion of the <code>Address already in use</code> error message,
261 including other causes.</a></li>
262 </ul>
263 </div>
264 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
265 <div class="directive-section"><h2><a name="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">Directive</a><a title="Permanent link" href="#listenbacklog" class="permalink">&para;</a></h2>
266 <table class="directive">
267 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum length of the queue of pending connections</td></tr>
268 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenBacklog <var>backlog</var></code></td></tr>
269 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenBacklog 511</code></td></tr>
270 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
271 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
272 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
273 </table>
274     <p>The maximum length of the queue of pending connections.
275     Generally no tuning is needed or desired, however on some
276     systems it is desirable to increase this when under a TCP SYN
277     flood attack. See the backlog parameter to the
278     <code>listen(2)</code> system call.</p>
279
280     <p>This will often be limited to a smaller number by the
281     operating system. This varies from OS to OS. Also note that
282     many OSes do not use exactly what is specified as the backlog,
283     but use a number based on (but normally larger than) what is
284     set.</p>
285
286 </div>
287 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
288 <div class="directive-section"><h2><a name="ListenCoresBucketsRatio" id="ListenCoresBucketsRatio">ListenCoresBucketsRatio</a> <a name="listencoresbucketsratio" id="listencoresbucketsratio">Directive</a><a title="Permanent link" href="#listencoresbucketsratio" class="permalink">&para;</a></h2>
289 <table class="directive">
290 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Ratio between the number of CPU cores (online) and the number of
291 listeners' buckets</td></tr>
292 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenCoresBucketsRatio <var>ratio</var></code></td></tr>
293 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenCoresBucketsRatio 0 (disabled)</code></td></tr>
294 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
295 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
296 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
297 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.4.17, with a kernel supporting
298 the socket option <code>SO_REUSEPORT</code> and distributing new connections
299 evenly across listening processes' (or threads') sockets using it (eg. Linux
300 3.9 and later, but not the current implementations of <code>SO_REUSEPORT</code>
301 in *BSDs.</td></tr>
302 </table>
303     <p>A <var>ratio</var> between the number of (online) CPU cores and the
304     number of listeners' buckets can be used to make Apache HTTP Server create
305     <code>num_cpu_cores / ratio</code> listening buckets, each containing its
306     own <code class="directive"><a href="#listen">Listen</a></code>-ing socket(s) on the same port(s), and
307     then make each child handle a single bucket (with round-robin distribution
308     of the buckets at children creation time).</p>
309
310     <div class="note"><h3>Meaning of "online" CPU core</h3>
311     <p>On Linux (and also BSD) a CPU core can be turned on/off if 
312     <a href="https://www.kernel.org/doc/Documentation/cpu-hotplug.txt">Hotplug</a> 
313     is configured, therefore <code class="directive">ListenCoresBucketsRatio</code> needs to
314     take this parameter into account while calculating the number of buckets to create.</p>
315     </div>
316
317     <p><code class="directive">ListenCoresBucketsRatio</code> can improve the
318     scalability when accepting new connections is/becomes the bottleneck.
319     On systems with a large number of CPU cores, enabling this feature has
320     been tested to show significant performances improvement and shorter
321     responses time.</p>
322
323     <p>There must be at least twice the number of CPU cores than the
324     configured <var>ratio</var> for this to be active. The recommended
325     <var>ratio</var> is <code>8</code>, hence at least <code>16</code>
326     cores should be available at runtime when this value is used.
327     The right <var>ratio</var> to obtain maximum performance needs to be calculated
328     for each target system, testing multiple values and observing the variations in your 
329     key performance metrics.</p>
330
331     <p>This directive influences the calculation of the 
332     <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code> and 
333     <code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code> lower bound values.
334     The number of children processes needs to be a multiple of the number 
335     of buckets to optimally accept connections.</p>
336
337     <div class="note">
338     <h3>Multiple <code class="directive">Listen</code>ers or Apache HTTP servers on
339     the same IP address and port</h3>
340     <p>Setting the <code>SO_REUSEPORT</code> option on the listening socket(s)
341     consequently allows multiple processes (sharing the same <code>EUID</code>,
342     e.g. <code>root</code>) to bind to the the same IP address and port,
343     without the binding error raised by the system in the usual case.</p>
344     <p>This also means that multiple instances of Apache httpd configured on a
345     same <code>IP:port</code> and with a positive <code class="directive">ListenCoresBucketsRatio</code>
346     would start without an error too, and then run with incoming connections
347     evenly distributed accross both instances (this is NOT a recommendation or
348     a sensible usage in any case, but just a notice that it would prevent such
349     possible issues to be detected).</p>
350     <p>Within the same instance, Apache httpd will check and fail to start if
351     multiple <code class="directive">Listen</code> directives on the exact same IP (or
352     hostname) and port are configured, thus avoiding the creation of some
353     duplicated buckets which would be useless and kill performances.  However
354     it can't (and won't try harder to) catch all the possible overlapping cases
355     (like a hostname resolving to an IP used elsewhere).</p>
356     </div>
357
358 </div>
359 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
360 <div class="directive-section"><h2><a name="MaxConnectionsPerChild" id="MaxConnectionsPerChild">MaxConnectionsPerChild</a> <a name="maxconnectionsperchild" id="maxconnectionsperchild">Directive</a><a title="Permanent link" href="#maxconnectionsperchild" class="permalink">&para;</a></h2>
361 <table class="directive">
362 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit on the number of connections that an individual child server
363 will handle during its life</td></tr>
364 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxConnectionsPerChild <var>number</var></code></td></tr>
365 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxConnectionsPerChild 0</code></td></tr>
366 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
367 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
368 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
369 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available Apache HTTP Server 2.3.9 and later. The old name
370 <code>MaxRequestsPerChild</code> is still supported.</td></tr>
371 </table>
372     <p>The <code class="directive">MaxConnectionsPerChild</code> directive sets
373     the limit on the number of connections that an individual child
374     server process will handle. After
375     <code class="directive">MaxConnectionsPerChild</code> connections, the child
376     process will die. If <code class="directive">MaxConnectionsPerChild</code> is
377     <code>0</code>, then the process will never expire.</p>
378
379     <p>Setting <code class="directive">MaxConnectionsPerChild</code> to a
380     non-zero value limits the amount of memory that process can consume
381     by (accidental) memory leakage.</p>
382
383 </div>
384 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
385 <div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a><a title="Permanent link" href="#maxmemfree" class="permalink">&para;</a></h2>
386 <table class="directive">
387 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of memory that the main allocator is allowed
388 to hold without calling <code>free()</code></td></tr>
389 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxMemFree <var>KBytes</var></code></td></tr>
390 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxMemFree 2048</code></td></tr>
391 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
392 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
393 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code></td></tr>
394 </table>
395     <p>The <code class="directive">MaxMemFree</code> directive sets the
396     maximum number of free Kbytes that every allocator is allowed
397     to hold without calling <code>free()</code>. In threaded MPMs, every
398     thread has its own allocator. When set
399     to zero, the threshold will be set to unlimited.</p>
400
401 </div>
402 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
403 <div class="directive-section"><h2><a name="MaxRequestWorkers" id="MaxRequestWorkers">MaxRequestWorkers</a> <a name="maxrequestworkers" id="maxrequestworkers">Directive</a><a title="Permanent link" href="#maxrequestworkers" class="permalink">&para;</a></h2>
404 <table class="directive">
405 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of connections that will be processed
406 simultaneously</td></tr>
407 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRequestWorkers <var>number</var></code></td></tr>
408 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
409 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
410 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
411 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
412 </table>
413     <p>The <code class="directive">MaxRequestWorkers</code> directive sets the limit
414     on the number of simultaneous requests that will be served.  Any
415     connection attempts over the <code class="directive">MaxRequestWorkers</code>
416     limit will normally be queued, up to a number based on the
417     <code class="directive"><a href="#listenbacklog">ListenBacklog</a></code>
418     directive. Once a child process is freed at the end of a different
419     request, the connection will then be serviced.</p>
420
421     <p>For non-threaded servers (<em>i.e.</em>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>),
422     <code class="directive">MaxRequestWorkers</code> translates into the maximum
423     number of child processes that will be launched to serve requests.
424     The default value is <code>256</code>; to increase it, you must also raise
425     <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
426
427     <p>For threaded and hybrid servers (<em>e.g.</em> <code class="module"><a href="../mod/event.html">event</a></code>
428     or <code class="module"><a href="../mod/worker.html">worker</a></code>) <code class="directive">MaxRequestWorkers</code> restricts
429     the total number of threads that will be available to serve clients.
430     For hybrid MPMs the default value is <code>16</code> (<code class="directive"><a href="#serverlimit">ServerLimit</a></code>) multiplied by the value of
431     <code>25</code> (<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>). Therefore, to increase <code class="directive">MaxRequestWorkers</code> to a value that requires more than 16 processes,
432     you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
433
434     <p><code class="directive">MaxRequestWorkers</code> was called
435     <code class="directive">MaxClients</code> before version 2.3.13. The old name is still
436     supported.</p>
437
438 </div>
439 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
440 <div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a><a title="Permanent link" href="#maxsparethreads" class="permalink">&para;</a></h2>
441 <table class="directive">
442 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle threads</td></tr>
443 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareThreads <var>number</var></code></td></tr>
444 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
445 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
446 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
447 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
448 </table>
449     <p>Maximum number of idle threads. Different MPMs deal with this
450     directive differently.</p>
451
452     <p>For <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code>, the default is
453     <code>MaxSpareThreads 250</code>. These MPMs deal with idle threads
454     on a server-wide basis. If there are too many idle threads in the
455     server then child processes are killed until the number of idle
456     threads is less than this number. Additional processes/threads
457     might be created if <code class="directive"><a href="#listencoresbucketsratio">ListenCoresBucketsRatio</a></code> 
458     is enabled.</p>
459
460     <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
461     <code>MaxSpareThreads 100</code>. Since this MPM runs a
462     single-process, the spare thread count is also server-wide.</p>
463
464     <p><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> works
465     similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. For
466     <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>10</code>.</p>
467
468     <div class="note"><h3>Restrictions</h3>
469       <p>The range of the <code class="directive">MaxSpareThreads</code> value
470       is restricted. Apache httpd will correct the given value automatically
471       according to the following rules:</p>
472       <ul>
473         <li><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> wants the value to be greater than
474         <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>.</li>
475
476         <li>For <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code>, the value
477         must be greater or equal to the sum of <code class="directive"><a href="#minsparethreads">
478         MinSpareThreads</a></code> and <code class="directive"><a href="#threadsperchild">
479         ThreadsPerChild</a></code>.</li>
480       </ul>
481     </div>
482
483 <h3>See also</h3>
484 <ul>
485 <li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li>
486 <li><code class="directive"><a href="#startservers">StartServers</a></code></li>
487 <li><code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code></li>
488 </ul>
489 </div>
490 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
491 <div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a><a title="Permanent link" href="#minsparethreads" class="permalink">&para;</a></h2>
492 <table class="directive">
493 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle threads available to handle request
494 spikes</td></tr>
495 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareThreads <var>number</var></code></td></tr>
496 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
497 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
498 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
499 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
500 </table>
501     <p>Minimum number of idle threads to handle request spikes.
502     Different MPMs deal with this directive differently.</p>
503
504     <p><code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code> use a default of
505     <code>MinSpareThreads 75</code> and deal with idle threads on a server-wide
506     basis. If there aren't enough idle threads in the server then child
507     processes are created until the number of idle threads is greater
508     than <var>number</var>. Additional processes/threads
509     might be created if <code class="directive"><a href="#listencoresbucketsratio">ListenCoresBucketsRatio</a></code> 
510     is enabled.</p>
511
512     <p><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> uses a default of
513     <code>MinSpareThreads 10</code> and, since it is a single-process
514     MPM, tracks this on a server-wide bases.</p>
515
516     <p><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> works
517     similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>.  For
518     <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>5</code>.</p>
519
520 <h3>See also</h3>
521 <ul>
522 <li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li>
523 <li><code class="directive"><a href="#startservers">StartServers</a></code></li>
524 <li><code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code></li>
525 </ul>
526 </div>
527 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
528 <div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">Directive</a><a title="Permanent link" href="#pidfile" class="permalink">&para;</a></h2>
529 <table class="directive">
530 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File where the server records the process ID
531 of the daemon</td></tr>
532 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PidFile <var>filename</var></code></td></tr>
533 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>PidFile httpd.pid</code></td></tr>
534 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
535 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
536 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
537 </table>
538     <p>The <code class="directive">PidFile</code> directive sets the file to
539     which the server records the process id of the daemon. If the
540     filename is not absolute then it is assumed to be relative to the
541     <code class="directive"><a href="../mod/core.html#defaultruntimedir">DefaultRuntimeDir</a></code>.</p>
542
543     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">PidFile /var/run/apache.pid</pre>
544 </div>
545
546     <p>It is often useful to be able to send the server a signal,
547     so that it closes and then re-opens its <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code> and <code class="directive"><a href="../mod/mod_log_config.html#transferlog">TransferLog</a></code>, and
548     re-reads its configuration files. This is done by sending a
549     SIGHUP (kill -1) signal to the process id listed in the
550     <code class="directive">PidFile</code>.</p>
551
552     <p>The <code class="directive">PidFile</code> is subject to the same
553     warnings about log file placement and <a href="../misc/security_tips.html#serverroot">security</a>.</p>
554
555     <div class="note"><h3>Note</h3>
556       <p>As of Apache HTTP Server 2, we recommended that you only use the <code class="program"><a href="../programs/apachectl.html">apachectl</a></code> script, or the init script that your OS provides,
557       for (re-)starting or stopping the server.</p>
558     </div>
559
560 </div>
561 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
562 <div class="directive-section"><h2><a name="ReceiveBufferSize" id="ReceiveBufferSize">ReceiveBufferSize</a> <a name="receivebuffersize" id="receivebuffersize">Directive</a><a title="Permanent link" href="#receivebuffersize" class="permalink">&para;</a></h2>
563 <table class="directive">
564 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP receive buffer size</td></tr>
565 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ReceiveBufferSize <var>bytes</var></code></td></tr>
566 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ReceiveBufferSize 0</code></td></tr>
567 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
568 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
569 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
570 </table>
571     <p>The server will set the TCP receive buffer size to the number of
572     bytes specified.</p>
573
574     <p>If set to the value of <code>0</code>, the server will use the
575     OS default.</p>
576
577 </div>
578 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
579 <div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">Directive</a><a title="Permanent link" href="#scoreboardfile" class="permalink">&para;</a></h2>
580 <table class="directive">
581 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the file used to store coordination data for
582 the child processes</td></tr>
583 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScoreBoardFile <var>file-path</var></code></td></tr>
584 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScoreBoardFile apache_runtime_status</code></td></tr>
585 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
586 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
587 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
588 </table>
589     <p>Apache HTTP Server uses a scoreboard to communicate between its parent
590     and child processes.  Some architectures require a file to facilitate
591     this communication. If the file is left unspecified, Apache httpd first
592     attempts to create the scoreboard entirely in memory (using anonymous
593     shared memory) and, failing that, will attempt to create the file on
594     disk (using file-based shared memory). Specifying this directive causes
595     Apache httpd to always create the file on the disk.</p>
596
597     <p>If <var>file-path</var> is not an absolute path, the location specified
598     will be relative to the value of
599     <code class="directive"><a href="../mod/core.html#defaultruntimedir">DefaultRuntimeDir</a></code>.</p>
600
601     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">ScoreBoardFile /var/run/apache_runtime_status</pre>
602 </div>
603
604     <p>File-based shared memory is useful for third-party applications
605     that require direct access to the scoreboard.</p>
606
607     <p>If you use a <code class="directive">ScoreBoardFile</code> then
608     you may see improved speed by placing it on a RAM disk. But be
609     careful that you heed the same warnings about log file placement
610     and <a href="../misc/security_tips.html">security</a>.</p>
611
612 <h3>See also</h3>
613 <ul>
614 <li><a href="../stopping.html">Stopping and Restarting
615 Apache HTTP Server</a></li>
616 </ul>
617 </div>
618 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
619 <div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">Directive</a><a title="Permanent link" href="#sendbuffersize" class="permalink">&para;</a></h2>
620 <table class="directive">
621 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP buffer size</td></tr>
622 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SendBufferSize <var>bytes</var></code></td></tr>
623 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SendBufferSize 0</code></td></tr>
624 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
625 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
626 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
627 </table>
628     <p>Sets the server's TCP send buffer size to the number of bytes
629     specified. It is often useful to set this past the OS's standard
630     default value on high speed, high latency connections
631     (<em>i.e.</em>, 100ms or so, such as transcontinental fast pipes).</p>
632
633     <p>If set to the value of <code>0</code>, the server will use the
634     default value provided by your OS.</p>
635
636     <p>Further configuration of your operating system may be required to elicit
637     better performance on high speed, high latency connections.</p>
638
639     <div class="note"> <p> On some operating systems, changes in TCP behavior resulting
640     from a larger <code class="directive">SendBufferSize</code> may not be seen unless
641     <code class="directive"><a href="../mod/core.html#enablesendfile">EnableSendfile</a></code> is set to OFF.  This
642     interaction applies only to static files.</p> </div>
643
644
645 </div>
646 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
647 <div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">Directive</a><a title="Permanent link" href="#serverlimit" class="permalink">&para;</a></h2>
648 <table class="directive">
649 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Upper limit on configurable number of processes</td></tr>
650 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerLimit <var>number</var></code></td></tr>
651 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
652 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
653 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
654 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
655 </table>
656     <p>For the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, this directive sets the
657     maximum configured value for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> for the lifetime of the
658     Apache httpd process. For the <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event
659     </a></code> MPMs, this directive in combination with <code class="directive"><a href="#threadlimit">ThreadLimit</a></code> sets
660     the maximum configured value for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> for the lifetime of the
661     Apache httpd process. For the <code class="module"><a href="../mod/event.html">event</a></code> MPM, this directive
662     also defines how many old server processes may keep running and finish processing
663     open connections.
664     Any attempts to change this directive during a restart will be ignored, but
665     <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> can be modified
666     during a restart.</p>
667
668     <p>Special care must be taken when using this directive.  If
669     <code class="directive">ServerLimit</code> is set to a value much higher
670     than necessary, extra, unused shared memory will be allocated.  If
671     both <code class="directive">ServerLimit</code> and <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> are set to values
672     higher than the system can handle, Apache httpd may not start or the
673     system may become unstable.</p>
674
675     <p>With the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, use this directive only
676     if you need to set <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> higher than 256 (default).
677     Do not set the value of this directive any higher than what you
678     might want to set <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> to.</p>
679
680     <p>With <code class="module"><a href="../mod/worker.html">worker</a></code>, use this directive only if your
681     <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers
682     </a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>
683     settings require more than 16 server processes (default). Do not set
684     the value of this directive any higher than the number of server
685     processes required by what you may want for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers </a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</p>
686
687     <p>With <code class="module"><a href="../mod/event.html">event</a></code>, increase this directive if the process
688     number defined by your <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> settings, plus the
689     number of gracefully shutting down processes, is more than 16 server
690     processes (default).</p>
691
692     <div class="note"><h3>Note</h3>
693       <p>There is a hard limit of <code>ServerLimit 20000</code> compiled
694       into the server (for the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM 200000). This is
695       intended to avoid nasty effects caused by typos. To increase it
696       even further past this limit, you will need to modify the value of
697       MAX_SERVER_LIMIT in the mpm source file and rebuild the server.</p>
698     </div>
699
700 <h3>See also</h3>
701 <ul>
702 <li><a href="../stopping.html">Stopping and Restarting Apache HTTP Server</a></li>
703 </ul>
704 </div>
705 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
706 <div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">Directive</a><a title="Permanent link" href="#startservers" class="permalink">&para;</a></h2>
707 <table class="directive">
708 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of child server processes created at startup</td></tr>
709 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartServers <var>number</var></code></td></tr>
710 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
711 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
712 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
713 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
714 </table>
715     <p>The <code class="directive">StartServers</code> directive sets the
716     number of child server processes created on startup. As the number
717     of processes is dynamically controlled depending on the load, (see
718     <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>,
719     <code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code>,
720     <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>)
721     there is usually little reason to adjust this parameter.</p>
722
723     <p>The default value differs from MPM to MPM. <code class="module"><a href="../mod/worker.html">worker</a></code> and
724     <code class="module"><a href="../mod/event.html">event</a></code> default to <code>StartServers 3</code>; <code class="module"><a href="../mod/prefork.html">
725     prefork</a></code> defaults to <code>5</code>; <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>
726     defaults to <code>2</code>.</p>
727
728 </div>
729 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
730 <div class="directive-section"><h2><a name="StartThreads" id="StartThreads">StartThreads</a> <a name="startthreads" id="startthreads">Directive</a><a title="Permanent link" href="#startthreads" class="permalink">&para;</a></h2>
731 <table class="directive">
732 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created on startup</td></tr>
733 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartThreads <var>number</var></code></td></tr>
734 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
735 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
736 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
737 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code></td></tr>
738 </table>
739     <p>Number of threads created on startup. As the
740     number of threads is dynamically controlled depending on the
741     load, (see
742     <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>,
743     <code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code>,
744     <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>)
745     there is usually little reason to adjust this
746     parameter.</p>
747
748     <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
749     <code>StartThreads 50</code> and, since there is only a single
750     process, this is the total number of threads created at startup to
751     serve requests.</p>
752
753 </div>
754 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
755 <div class="directive-section"><h2><a name="ThreadLimit" id="ThreadLimit">ThreadLimit</a> <a name="threadlimit" id="threadlimit">Directive</a><a title="Permanent link" href="#threadlimit" class="permalink">&para;</a></h2>
756 <table class="directive">
757 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the upper limit on the configurable number of threads
758 per child process</td></tr>
759 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadLimit <var>number</var></code></td></tr>
760 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
761 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
762 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
763 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
764 </table>
765     <p>This directive sets the maximum configured value for <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the lifetime
766     of the Apache httpd process.  Any attempts to change this directive
767     during a restart will be ignored, but <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> can be modified
768     during a restart up to the value of this directive.</p>
769
770     <p>Special care must be taken when using this directive.  If
771     <code class="directive">ThreadLimit</code> is set to a value much higher
772     than <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>,
773     extra unused shared memory will be allocated.  If both
774     <code class="directive">ThreadLimit</code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> are set to values
775     higher than the system can handle, Apache httpd may not start or the
776     system may become unstable. Do not set the value of this directive
777     any higher than your greatest predicted setting of <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the
778     current run of Apache httpd.</p>
779
780     <p>The default value for <code class="directive">ThreadLimit</code> is
781     <code>1920</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
782     <code>64</code> when used with the others.</p>
783
784     <div class="note"><h3>Note</h3>
785       <p>There is a hard limit of <code>ThreadLimit 20000</code> (or
786       <code>ThreadLimit 100000</code> with <code class="module"><a href="../mod/event.html">event</a></code>,
787       <code>ThreadLimit 15000</code> with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>)
788       compiled into the server. This is intended to avoid nasty effects
789       caused by typos. To increase it even further past this limit, you
790       will need to modify the value of MAX_THREAD_LIMIT in the mpm
791       source file and rebuild the server.</p>
792     </div>
793
794 </div>
795 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
796 <div class="directive-section"><h2><a name="ThreadsPerChild" id="ThreadsPerChild">ThreadsPerChild</a> <a name="threadsperchild" id="threadsperchild">Directive</a><a title="Permanent link" href="#threadsperchild" class="permalink">&para;</a></h2>
797 <table class="directive">
798 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created by each child process</td></tr>
799 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadsPerChild <var>number</var></code></td></tr>
800 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
801 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
802 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
803 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
804 </table>
805     <p>This directive sets the number of threads created by each
806     child process. The child creates these threads at startup and
807     never creates more. If using an MPM like <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>,
808     where there is only one child process, this number should be high
809     enough to handle the entire load of the server. If using an MPM
810     like <code class="module"><a href="../mod/worker.html">worker</a></code>, where there are multiple child processes,
811     the <em>total</em> number of threads should be high enough to handle
812     the common load on the server.</p>
813
814     <p>The default value for <code class="directive">ThreadsPerChild</code> is
815     <code>64</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
816     <code>25</code> when used with the others.</p>
817     
818     <p>The value of <code class="directive">ThreadsPerChild</code> can not exceed the
819     value of <code class="directive"><a href="#threadslimit">ThreadsLimit</a></code>. If a
820     higher value is configured, it will be automatically reduced at start-up
821     and a warning will be logged. The relationship between these 2 directives
822     is explained in <code class="directive"><a href="#threadslimit">ThreadsLimit</a></code>.</p>
823
824 </div>
825 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
826 <div class="directive-section"><h2><a name="ThreadStackSize" id="ThreadStackSize">ThreadStackSize</a> <a name="threadstacksize" id="threadstacksize">Directive</a><a title="Permanent link" href="#threadstacksize" class="permalink">&para;</a></h2>
827 <table class="directive">
828 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The size in bytes of the stack used by threads handling
829 client connections</td></tr>
830 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadStackSize <var>size</var></code></td></tr>
831 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>65536 on NetWare; varies on other operating systems</code></td></tr>
832 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
833 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
834 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
835 </table>
836     <p>The <code class="directive">ThreadStackSize</code> directive sets the
837     size of the stack (for autodata) of threads which handle client
838     connections and call modules to help process those connections.
839     In most cases the operating system default for stack size is
840     reasonable, but there are some conditions where it may need to be
841     adjusted:</p>
842
843     <ul>
844       <li>On platforms with a relatively small default thread stack size
845       (e.g., HP-UX), Apache httpd may crash when using some third-party modules
846       which use a relatively large amount of autodata storage.  Those
847       same modules may have worked fine on other platforms where the
848       default thread stack size is larger.  This type of crash is
849       resolved by setting <code class="directive">ThreadStackSize</code> to a
850       value higher than the operating system default.  This type of
851       adjustment is necessary only if the provider of the third-party
852       module specifies that it is required, or if diagnosis of an Apache httpd
853       crash indicates that the thread stack size was too small.</li>
854
855       <li>On platforms where the default thread stack size is
856       significantly larger than necessary for the web server
857       configuration, a higher number of threads per child process
858       will be achievable if <code class="directive">ThreadStackSize</code> is
859       set to a value lower than the operating system default.  This type
860       of adjustment should only be made in a test environment which allows
861       the full set of web server processing can be exercised, as there
862       may be infrequent requests which require more stack to process.
863       The minimum required stack size strongly depends on the modules
864       used, but any change in the web server configuration can invalidate
865       the current <code class="directive">ThreadStackSize</code> setting.</li>
866
867       <li>On Linux, this directive can only be used to increase the default
868       stack size, as the underlying system call uses the value as a
869       <em>minimum</em> stack size.  The (often large) soft limit for
870       <code>ulimit -s</code> (8MB if unlimited) is used as the default stack
871       size.</li>
872     </ul>
873
874     <div class="note">It is recommended to not reduce <code class="directive">ThreadStackSize</code>
875     unless a high number of threads per child process is needed. On some
876     platforms (including Linux), a setting of 128000 is already too low and
877     causes crashes with some common modules.</div>
878
879 </div>
880 </div>
881 <div class="bottomlang">
882 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
883 <a href="../en/mod/mpm_common.html" title="English">&nbsp;en&nbsp;</a> |
884 <a href="../fr/mod/mpm_common.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
885 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
886 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
887 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
888 <script type="text/javascript"><!--//--><![CDATA[//><!--
889 var comments_shortname = 'httpd';
890 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mpm_common.html';
891 (function(w, d) {
892     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
893         d.write('<div id="comments_thread"><\/div>');
894         var s = d.createElement('script');
895         s.type = 'text/javascript';
896         s.async = true;
897         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
898         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
899     }
900     else {
901         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
902     }
903 })(window, document);
904 //--><!]]></script></div><div id="footer">
905 <p class="apache">Copyright 2018 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
906 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
907 if (typeof(prettyPrint) !== 'undefined') {
908     prettyPrint();
909 }
910 //--><!]]></script>
911 </body></html>