97a9a944b5887e91042b019776c41d5dd74557aferikabele<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive This file is generated from xml source: DO NOT EDIT
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc<title>worker - Apache HTTP Server Version 2.5</title>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<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" />
2e545ce2450a9953665f701bb05350f0d3f26275nd<script src="/style/scripts/prettify.min.js" type="text/javascript">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/images/favicon.ico" rel="shortcut icon" /></head>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<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>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Modules</a></div>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<p><span>Available Languages: </span><a href="/de/mod/worker.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/en/mod/worker.html" title="English"> en </a> |
e1e8390280254f7f0580d701e583f670643d4f3fnilgun<a href="/ja/mod/worker.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/tr/mod/worker.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Multi-Processing Module implementing a hybrid
5a58787efeb02a1c3f06569d019ad81fd2efa06end<tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>mpm_worker_module</td></tr>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>worker.c</td></tr></table>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p>This Multi-Processing Module (MPM) implements a hybrid
ced7ef1f8c0df1805da0e87dbc5a1b6282910573nd multi-process multi-threaded server. By using threads to serve
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive requests, it is able to serve a large number of requests with
ced7ef1f8c0df1805da0e87dbc5a1b6282910573nd fewer system resources than a process-based server. However, it
b21197dc8e6b8c764fdcc24d4bae8b0eebb6bc4end retains much of the stability of a process-based server by
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive keeping multiple processes available, each with many threads.</p>
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive <p>The most important directives used to control this MPM are
97a9a944b5887e91042b019776c41d5dd74557aferikabele <code class="directive"><a href="/mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code>, which
f8396ed8364b56ec8adeaa49cac35a929758a29eslive controls the number of threads deployed by each child process and
ffb01336be79c64046b636e59fa8ddca8ec029edsf <code class="directive"><a href="/mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code>, which
f8396ed8364b56ec8adeaa49cac35a929758a29eslive controls the maximum total number of threads that may be
f8396ed8364b56ec8adeaa49cac35a929758a29eslive launched.</p>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<li><img alt="" src="/images/down.gif" /> <a href="#how-it-works">How it Works</a></li>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#coredumpdirectory">CoreDumpDirectory</a></li>
deeee6bb6fd94c0ba5f3730b58abd9d299c89ccdnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#enableexceptionhook">EnableExceptionHook</a></li>
4db28ee269aa06f7c6232e11cd01f58c3349af23noodl<li><img alt="" src="/images/right.gif" /> <a href="mod_unixd.html#group">Group</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#listen">Listen</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#listenbacklog">ListenBacklog</a></li>
4a31db3c3a0202003c1b9f87affa7cc143e120e5sf<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxmemfree">MaxMemFree</a></li>
ffb01336be79c64046b636e59fa8ddca8ec029edsf<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxsparethreads">MaxSpareThreads</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#minsparethreads">MinSpareThreads</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#pidfile">PidFile</a></li>
2bc7f1cf720973a67f8ff7a8d523e40569ae5b6cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#receivebuffersize">ReceiveBufferSize</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#scoreboardfile">ScoreBoardFile</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#sendbuffersize">SendBufferSize</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#serverlimit">ServerLimit</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#startservers">StartServers</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#threadlimit">ThreadLimit</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#threadsperchild">ThreadsPerChild</a></li>
87ffb6e33f3cbef3b9bb406cc2d27039fa336eaatrawick<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#threadstacksize">ThreadStackSize</a></li>
4db28ee269aa06f7c6232e11cd01f58c3349af23noodl<li><img alt="" src="/images/right.gif" /> <a href="mod_unixd.html#user">User</a></li>
654d8eb036bedc99e90e11910ee02d3421417697rbowen<li><a href="/bind.html">Setting which addresses and ports Apache HTTP Server uses</a></li>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="how-it-works" id="how-it-works">How it Works</a></h2>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <p>A single control process (the parent) is responsible for launching
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick child processes. Each child process creates a fixed number of server
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick threads as specified in the <code class="directive"><a href="/mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code> directive, as well
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick as a listener thread which listens for connections and passes them
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick to a server thread for processing when they arrive.</p>
654d8eb036bedc99e90e11910ee02d3421417697rbowen <p>Apache HTTP Server always tries to maintain a pool of <dfn>spare</dfn> or
06ba4a61654b3763ad65f52283832ebf058fdf1cslive idle server threads, which stand ready to serve incoming
06ba4a61654b3763ad65f52283832ebf058fdf1cslive requests. In this way, clients do not need to wait for a new
06ba4a61654b3763ad65f52283832ebf058fdf1cslive threads or processes to be created before their requests can be
b1b0d8ff12f69d873f28a9bf79dfba6b67b45a4bigalic served. The number of processes that will initially launch is
97a9a944b5887e91042b019776c41d5dd74557aferikabele set by the <code class="directive"><a href="/mod/mpm_common.html#startservers">StartServers</a></code>
654d8eb036bedc99e90e11910ee02d3421417697rbowen directive. During operation, the server assesses the total number
92510838f2eb125726e15c5eb4f7a23c7a0396e4slive of idle threads in all processes, and forks or kills processes to
97a9a944b5887e91042b019776c41d5dd74557aferikabele keep this number within the boundaries specified by <code class="directive"><a href="/mod/mpm_common.html#minsparethreads">MinSpareThreads</a></code> and <code class="directive"><a href="/mod/mpm_common.html#maxsparethreads">MaxSpareThreads</a></code>. Since this
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive process is very self-regulating, it is rarely necessary to modify
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive these directives from their default values. The maximum number of
92510838f2eb125726e15c5eb4f7a23c7a0396e4slive clients that may be served simultaneously (i.e., the maximum total
92510838f2eb125726e15c5eb4f7a23c7a0396e4slive number of threads in all processes) is determined by the
ffb01336be79c64046b636e59fa8ddca8ec029edsf <code class="directive"><a href="/mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code> directive.
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick The maximum number of active child processes is determined by
ffb01336be79c64046b636e59fa8ddca8ec029edsf the <code class="directive"><a href="/mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code>
b244bbf442a0aea3dc397b4d0d751f4716c5891dnd directive divided by the <code class="directive"><a href="/mod/mpm_common.html#threadsperchild">
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick <p>Two directives set hard limits on the number of active child
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick processes and the number of server threads in a child process,
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf and can only be changed by fully stopping the server and then
b244bbf442a0aea3dc397b4d0d751f4716c5891dnd starting it again. <code class="directive"><a href="/mod/mpm_common.html#serverlimit">ServerLimit
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf </a></code> is a hard limit on the number of active child
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf processes, and must be greater than or equal to the
ffb01336be79c64046b636e59fa8ddca8ec029edsf <code class="directive"><a href="/mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code>
b244bbf442a0aea3dc397b4d0d751f4716c5891dnd directive divided by the <code class="directive"><a href="/mod/mpm_common.html#threadsperchild">
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick <code class="directive"><a href="/mod/mpm_common.html#threadlimit">ThreadLimit</a></code> is a hard
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick limit of the number of server threads, and must be greater than
77c77cf89621f21c8e2bbad63058b5eaa5f88d4ajim or equal to the <code class="directive"><a href="/mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code> directive.</p>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <p>In addition to the set of active child processes, there may
ced7ef1f8c0df1805da0e87dbc5a1b6282910573nd be additional child processes which are terminating, but where at
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick least one server thread is still handling an existing client
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf connection. Up to <code class="directive"><a href="/mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code> terminating processes
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf may be present, though the actual number can be expected to be
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf much smaller. This behavior can be avoided by disabling the
ced7ef1f8c0df1805da0e87dbc5a1b6282910573nd termination of individual child processes, which is achieved using
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick the following:</p>
b244bbf442a0aea3dc397b4d0d751f4716c5891dnd <li>set the value of <code class="directive"><a href="/mod/mpm_common.html#maxconnectionsperchild">
b244bbf442a0aea3dc397b4d0d751f4716c5891dnd <li>set the value of <code class="directive"><a href="/mod/mpm_common.html#maxsparethreads">
ffb01336be79c64046b636e59fa8ddca8ec029edsf <code class="directive"><a href="/mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code></li>
92510838f2eb125726e15c5eb4f7a23c7a0396e4slive <p>A typical configuration of the process-thread controls in
97a9a944b5887e91042b019776c41d5dd74557aferikabele the <code class="module"><a href="/mod/worker.html">worker</a></code> MPM could look as follows:</p>
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalicStartServers 2
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalicMaxRequestWorkers 150
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalicMinSpareThreads 25
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalicMaxSpareThreads 75
4aa603e6448b99f9371397d439795c91a93637eandThreadsPerChild 25</pre>
e8d485701957d5c6de870111c112e168a894d49and <p>While the parent process is usually started as <code>root</code>
e8d485701957d5c6de870111c112e168a894d49and under Unix in order to bind to port 80, the child processes and threads
654d8eb036bedc99e90e11910ee02d3421417697rbowen are launched by the server as a less-privileged user. The <code class="directive"><a href="/mod/mod_unixd.html#user">User</a></code> and <code class="directive"><a href="/mod/mod_unixd.html#group">Group</a></code> directives are used to set
654d8eb036bedc99e90e11910ee02d3421417697rbowen the privileges of the Apache HTTP Server child processes. The child processes
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive must be able to read all the content that will be served, but
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive should have as few privileges beyond that as possible. In
9bcfc3697a91b5215893a7d0206865b13fc72148nd addition, unless <code class="program"><a href="/programs/suexec.html">suexec</a></code> is used,
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive these directives also set the privileges which will be inherited
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive by CGI scripts.</p>
4a31db3c3a0202003c1b9f87affa7cc143e120e5sf <p><code class="directive"><a href="/mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code>
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive controls how frequently the server recycles processes by killing
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive old ones and launching new ones.</p>
709e3a21ba73b8433462959cd56c773454b34441trawick <p>This MPM uses the <code>mpm-accept</code> mutex to serialize
709e3a21ba73b8433462959cd56c773454b34441trawick access to incoming connections when subject to the thundering herd
709e3a21ba73b8433462959cd56c773454b34441trawick problem (generally, when there are multiple listening sockets).
709e3a21ba73b8433462959cd56c773454b34441trawick The implementation aspects of this mutex can be configured with the
709e3a21ba73b8433462959cd56c773454b34441trawick <code class="directive"><a href="/mod/core.html#mutex">Mutex</a></code> directive. The <a href="/misc/perf-tuning.html">performance hints</a>
709e3a21ba73b8433462959cd56c773454b34441trawick documentation has additional information about this mutex.</p>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<p><span>Available Languages: </span><a href="/de/mod/worker.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/en/mod/worker.html" title="English"> en </a> |
e1e8390280254f7f0580d701e583f670643d4f3fnilgun<a href="/ja/mod/worker.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/tr/mod/worker.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
727872d18412fc021f03969b8641810d8896820bhumbedooh</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&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>
727872d18412fc021f03969b8641810d8896820bhumbedoohvar comments_shortname = 'httpd';
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohvar comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/worker.html';
0d0ba3a410038e179b695446bb149cce6264e0abnd(function(w, d) {
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread"><\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd var s = d.createElement('script');
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
0d0ba3a410038e179b695446bb149cce6264e0abnd (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd})(window, document);
205f749042ed530040a4f0080dbcb47ceae8a374rjung<p class="apache">Copyright 2015 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>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<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[//><!--
0d0ba3a410038e179b695446bb149cce6264e0abndif (typeof(prettyPrint) !== 'undefined') {
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd prettyPrint();