worker.html.en revision 4b5981e276e93df97c34e4da05ca5cf8bbd937da
97a9a944b5887e91042b019776c41d5dd74557aferikabele<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
97a9a944b5887e91042b019776c41d5dd74557aferikabele<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive This file is generated from xml source: DO NOT EDIT
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/images/favicon.ico" rel="shortcut icon" /></head>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz<p class="apache">Apache HTTP Server Version 2.3</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
4b5981e276e93df97c34e4da05ca5cf8bbd937dand<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.3</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> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/ja/mod/worker.html" hreflang="ja" rel="alternate" title="Japanese"> ja </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
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive multi-process multi-threaded server. By using threads to serve
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive requests, it is able to serve a large number of requests with
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive less system resources than a process-based server. Yet 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
97a9a944b5887e91042b019776c41d5dd74557aferikabele <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code>, which
f8396ed8364b56ec8adeaa49cac35a929758a29eslive controls the maximum total number of threads that may be
f8396ed8364b56ec8adeaa49cac35a929758a29eslive launched.</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div id="quickview"><h3 class="directives">Directives</h3>
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#acceptmutex">AcceptMutex</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>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.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>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#lockfile">LockFile</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxclients">MaxClients</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxmemfree">MaxMemFree</a></li>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</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>
117c1f888a14e73cdd821dc6c23eb0411144a41cnd<li><img alt="" src="/images/right.gif" /> <a href="mpm_common.html#user">User</a></li>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<li><img alt="" src="/images/down.gif" /> <a href="#how-it-works">How it Works</a></li>
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd<li><a href="/bind.html">Setting which addresses and ports Apache
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>
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick <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>
ea8a727ff298d2f5368b55b7ae8d87091ae106e7nd <p>Apache 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
92510838f2eb125726e15c5eb4f7a23c7a0396e4slive served. The number of processes that will initially launched is
97a9a944b5887e91042b019776c41d5dd74557aferikabele set by the <code class="directive"><a href="/mod/mpm_common.html#startservers">StartServers</a></code>
92510838f2eb125726e15c5eb4f7a23c7a0396e4slive directive. Then during operation, Apache 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
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code> directive.
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick The maximum number of active child processes is determined by
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick the <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code>
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick 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,
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick and can only be changed by fully stopping the server and then
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick starting it again. <code class="directive"><a href="/mod/mpm_common.html#serverlimit ">ServerLimit
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick </a></code> is a hard limit on the number of active child
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick processes, and must be greater than or equal to the
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code>
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick 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
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick or equal to the <code class="directive"><a href="/mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code> directive. If
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick non-default values are specified for these directives, they
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick should appear before other <code class="module"><a href="/mod/worker.html">worker</a></code> directives.</p>
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick <p>In addition to a the set of active child processes, there may
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick be additional child processes which are terminating but where at
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick least one server thread is still handling an existing client
e7131afdda636994bf3c7a6b2e77e5960fb62633nd connection. Up to <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</a></code> terminating processes
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick may be present, though the actual number can be expected to be
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick much smaller. This behavior can be avoided by disabling the
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick termination of individual child processes, which is achieved by
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick the following:</p>
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick <li>set the value of <code class="directive"><a href="/mod/mpm_common.html# maxrequestsperchild">
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick <li>set the value of <code class="directive"><a href="/mod/mpm_common.html# maxsparethreads">
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick <code class="directive"><a href="/mod/mpm_common.html#maxclients">MaxClients</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>
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick ServerLimit 16<br />
ea8a727ff298d2f5368b55b7ae8d87091ae106e7nd StartServers 2<br />
ea8a727ff298d2f5368b55b7ae8d87091ae106e7nd MaxClients 150<br />
ea8a727ff298d2f5368b55b7ae8d87091ae106e7nd MinSpareThreads 25<br />
ea8a727ff298d2f5368b55b7ae8d87091ae106e7nd MaxSpareThreads 75<br />
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick ThreadsPerChild 25
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
e8d485701957d5c6de870111c112e168a894d49and are launched by Apache as a less-privileged user. The <code class="directive"><a href="/mod/mpm_common.html#user">User</a></code> and <code class="directive"><a href="/mod/mpm_common.html#group">Group</a></code> directives are used to set
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive the privileges of the Apache 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>
97a9a944b5887e91042b019776c41d5dd74557aferikabele <p><code class="directive"><a href="/mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code>
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive controls how frequently the server recycles processes by killing
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive old ones and launching new ones.</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> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/ja/mod/worker.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
b95ae799514ad86a15610ad75808d7065e9847c9kess<p class="apache">Copyright 1995-2005 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>