📄 mpm_common.html.en
字号:
normally be left at its default value. The main reason for changing it is if the <code>logs</code> directory is NFS mounted, since <strong>the lockfile must be stored on a local disk</strong>. The PID of the main server process is automatically appended to the filename.</p> <div class="warning"><h3>Security</h3> <p>It is best to <em>avoid</em> putting this file in a world writable directory such as <code>/var/tmp</code> because someone could create a denial of service attack and prevent the server from starting by creating a lockfile with the same name as the one the server will try to create.</p> </div><h3>See also</h3><ul><li><code class="directive"><a href="#acceptmutex">AcceptMutex</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MaxClients" id="MaxClients">MaxClients</a> <a name="maxclients" id="maxclients">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of child processes that will be createdto serve requests</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxClients <var>number</var></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr></table> <p>The <code class="directive">MaxClients</code> directive sets the limit on the number of simultaneous requests that will be served. Any connection attempts over the <code class="directive">MaxClients</code> limit will normally be queued, up to a number based on the <code class="directive"><a href="#listenbacklog">ListenBacklog</a></code> directive. Once a child process is freed at the end of a different request, the connection will then be serviced.</p> <p>For non-threaded servers (<em>i.e.</em>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>), <code class="directive">MaxClients</code> translates into the maximum number of child processes that will be launched to serve requests. The default value is <code>256</code>; to increase it, you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p> <p>For threaded and hybrid servers (<em>e.g.</em> <code class="module"><a href="../mod/beos.html">beos</a></code> or <code class="module"><a href="../mod/worker.html">worker</a></code>) <code class="directive">MaxClients</code> restricts the total number of threads that will be available to serve clients. The default value for <code class="module"><a href="../mod/beos.html">beos</a></code> is <code>50</code>. For hybrid MPMs the default value is <code>16</code> (<code class="directive"><a href="#serverlimit">ServerLimit</a></code>) multiplied by the value of <code>25</code> (<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>). Therefore, to increase <code class="directive">MaxClients</code> to a value that requires more than 16 processes, you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of memory that the main allocator is allowedto hold without calling <code>free()</code></td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxMemFree <var>KBytes</var></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxMemFree 0</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</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></table> <p>The <code class="directive">MaxMemFree</code> directive sets the maximum number of free Kbytes that the main allocator is allowed to hold without calling <code>free()</code>. When not set, or when set to zero, the threshold will be set to unlimited.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MaxRequestsPerChild" id="MaxRequestsPerChild">MaxRequestsPerChild</a> <a name="maxrequestsperchild" id="maxrequestsperchild">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit on the number of requests that an individual child serverwill handle during its life</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRequestsPerChild <var>number</var></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRequestsPerChild 10000</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</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>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr></table> <p>The <code class="directive">MaxRequestsPerChild</code> directive sets the limit on the number of requests that an individual child server process will handle. After <code class="directive">MaxRequestsPerChild</code> requests, the child process will die. If <code class="directive">MaxRequestsPerChild</code> is <code>0</code>, then the process will never expire.</p> <div class="note"><h3>Different default values</h3> <p>The default value for <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> and <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> is <code>0</code>.</p> </div> <p>Setting <code class="directive">MaxRequestsPerChild</code> to a non-zero limit has two beneficial effects:</p> <ul> <li>it limits the amount of memory that process can consume by (accidental) memory leakage;</li> <li>by giving processes a finite lifetime, it helps reduce the number of processes when the server load reduces.</li> </ul> <div class="note"><h3>Note</h3> <p>For <code class="directive"><a href="../mod/core.html#keepalive">KeepAlive</a></code> requests, only the first request is counted towards this limit. In effect, it changes the behavior to limit the number of <em>connections</em> per child.</p> </div></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle threads</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareThreads <var>number</var></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</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>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr></table> <p>Maximum number of idle threads. Different MPMs deal with this directive differently.</p> <p>For <code class="module"><a href="../mod/perchild.html">perchild</a></code> the default is <code>MaxSpareThreads 10</code>. This MPM monitors the number of idle threads on a per-child basis. If there are too many idle threads in that child, the server will begin to kill threads within that child.</p> <p>For <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code> and <code class="module"><a href="../mod/threadpool.html">threadpool</a></code> the default is <code>MaxSpareThreads 250</code>. These MPMs deal with idle threads on a server-wide basis. If there are too many idle threads in the server then child processes are killed until the number of idle threads is less than this number.</p> <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is <code>MaxSpareThreads 100</code>. Since this MPM runs a single-process, the spare thread count is also server-wide.</p> <p><code class="module"><a href="../mod/beos.html">beos</a></code> and <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> work similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. The default for <code class="module"><a href="../mod/beos.html">beos</a></code> is <code>MaxSpareThreads 50</code>. For <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>10</code>.</p> <div class="note"><h3>Restrictions</h3> <p>The range of the <code class="directive">MaxSpareThreads</code> value is restricted. Apache will correct the given value automatically according to the following rules:</p> <ul> <li><code class="module"><a href="../mod/perchild.html">perchild</a></code> requires <code class="directive">MaxSpareThreads</code> to be less or equal than <code class="directive"><a href="#threadlimit">ThreadLimit</a></code>.</li> <li><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> wants the value to be greater than <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>.</li> <li>For <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code> and <code class="module"><a href="../mod/worker.html">worker</a></code> the value must be greater or equal than the sum of <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</li> </ul> </div><h3>See also</h3><ul><li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li><li><code class="directive"><a href="#startservers">StartServers</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a></h2><table class="directive">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -