github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/apache_2_2_34/manual/mod/worker.html.en (about)

     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>worker - Apache HTTP Server Version 2.2</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" /><link href="http://httpd.apache.org/docs/current/mod/worker.html" rel="canonical" /></head>
    18  <body>
    19  <div id="page-header">
    20  <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.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.2</p>
    22  <img alt="" src="../images/feather.gif" /></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.2</a> &gt; <a href="./">Modules</a></div>
    26  <div id="page-content">
    27  <div class="retired"><h4>Please note</h4>
    28              <p> This document refers to a legacy release (<strong>2.2</strong>) of Apache httpd. The active release (<strong>2.4</strong>) is documented <a href="http://httpd.apache.org/docs/current">here</a>. If you have not already upgraded, please follow <a href="http://httpd.apache.org/docs/current/upgrading.html">this link</a> for more information.</p>
    29          <p>You may follow <a href="http://httpd.apache.org/docs/current/mod/worker.html">this link</a> to go to the current version of this document.</p></div><div id="preamble"><h1>Apache MPM worker</h1>
    30  <div class="toplang">
    31  <p><span>Available Languages: </span><a href="../de/mod/worker.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
    32  <a href="../en/mod/worker.html" title="English">&nbsp;en&nbsp;</a> |
    33  <a href="../ja/mod/worker.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
    34  <a href="../tr/mod/worker.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
    35  </div>
    36  <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Multi-Processing Module implementing a hybrid
    37      multi-threaded multi-process web server</td></tr>
    38  <tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr>
    39  <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>mpm_worker_module</td></tr>
    40  <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>worker.c</td></tr></table>
    41  <h3>Summary</h3>
    42  
    43      <p>This Multi-Processing Module (MPM) implements a hybrid
    44      multi-process multi-threaded server. By using threads to serve
    45      requests, it is able to serve a large number of requests with
    46      fewer system resources than a process-based server. However, it
    47      retains much of the stability of a process-based server by
    48      keeping multiple processes available, each with many threads.</p>
    49  
    50      <p>The most important directives used to control this MPM are
    51      <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code>, which
    52      controls the number of threads deployed by each child process and
    53      <code class="directive"><a href="../mod/mpm_common.html#maxclients">MaxClients</a></code>, which
    54      controls the maximum total number of threads that may be
    55      launched.</p>
    56  </div>
    57  <div id="quickview"><h3>Topics</h3>
    58  <ul id="topics">
    59  <li><img alt="" src="../images/down.gif" /> <a href="#how-it-works">How it Works</a></li>
    60  </ul><h3 class="directives">Directives</h3>
    61  <ul id="toc">
    62  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#acceptmutex">AcceptMutex</a></li>
    63  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#coredumpdirectory">CoreDumpDirectory</a></li>
    64  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#enableexceptionhook">EnableExceptionHook</a></li>
    65  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#group">Group</a></li>
    66  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#listen">Listen</a></li>
    67  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#listenbacklog">ListenBacklog</a></li>
    68  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#lockfile">LockFile</a></li>
    69  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#maxclients">MaxClients</a></li>
    70  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#maxmemfree">MaxMemFree</a></li>
    71  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></li>
    72  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#maxsparethreads">MaxSpareThreads</a></li>
    73  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#minsparethreads">MinSpareThreads</a></li>
    74  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#pidfile">PidFile</a></li>
    75  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#receivebuffersize">ReceiveBufferSize</a></li>
    76  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#scoreboardfile">ScoreBoardFile</a></li>
    77  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#sendbuffersize">SendBufferSize</a></li>
    78  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#serverlimit">ServerLimit</a></li>
    79  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#startservers">StartServers</a></li>
    80  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#threadlimit">ThreadLimit</a></li>
    81  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#threadsperchild">ThreadsPerChild</a></li>
    82  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#threadstacksize">ThreadStackSize</a></li>
    83  <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#user">User</a></li>
    84  </ul>
    85  <h3>See also</h3>
    86  <ul class="seealso">
    87  <li><a href="../bind.html">Setting which addresses and ports Apache
    88  uses</a></li>
    89  </ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
    90  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
    91  <div class="section">
    92  <h2><a name="how-it-works" id="how-it-works">How it Works</a></h2>
    93      <p>A single control process (the parent) is responsible for launching 
    94      child processes. Each child process creates a fixed number of server
    95      threads as specified in the <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code> directive, as well
    96      as a listener thread which listens for connections and passes them
    97      to a server thread for processing when they arrive.</p>
    98  
    99      <p>Apache always tries to maintain a pool of <dfn>spare</dfn> or
   100      idle server threads, which stand ready to serve incoming
   101      requests. In this way, clients do not need to wait for a new
   102      threads or processes to be created before their requests can be
   103      served. The number of processes that will initially launch is
   104      set by the <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code>
   105      directive. During operation, Apache assesses the total number
   106      of idle threads in all processes, and forks or kills processes to
   107      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
   108      process is very self-regulating, it is rarely necessary to modify
   109      these directives from their default values. The maximum number of
   110      clients that may be served simultaneously (i.e., the maximum total
   111      number of threads in all processes) is determined by the
   112      <code class="directive"><a href="../mod/mpm_common.html#maxclients">MaxClients</a></code> directive.
   113      The maximum number of active child processes is determined by
   114      the <code class="directive"><a href="../mod/mpm_common.html#maxclients">MaxClients</a></code>
   115      directive divided by the <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">
   116      ThreadsPerChild</a></code> directive.</p>
   117  
   118      <p>Two directives set hard limits on the number of active child
   119      processes and the number of server threads in a child process,
   120      and can only be changed by fully stopping the server and then 
   121      starting it again.  <code class="directive"><a href="../mod/mpm_common.html#serverlimit">ServerLimit
   122      </a></code> is a hard limit on the number of active child 
   123      processes, and must be greater than or equal to the 
   124      <code class="directive"><a href="../mod/mpm_common.html#maxclients">MaxClients</a></code>
   125      directive divided by the <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">
   126      ThreadsPerChild</a></code> directive.  
   127      <code class="directive"><a href="../mod/mpm_common.html#threadlimit">ThreadLimit</a></code> is a hard
   128      limit of the number of server threads, and must be greater than
   129      or equal to the <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code> directive.  If 
   130      non-default values are specified for these directives, they 
   131      should appear before other <code class="module"><a href="../mod/worker.html">worker</a></code> directives.</p>
   132  
   133      <p>In addition to the set of active child processes, there may 
   134      be additional child processes which are terminating, but where at
   135      least one server thread is still handling an existing client
   136      connection.  Up to <code class="directive"><a href="../mod/mpm_common.html#maxclients">MaxClients</a></code> terminating processes 
   137      may be present, though the actual number can be expected to be 
   138      much smaller.  This behavior can be avoided by disabling the 
   139      termination of individual child processes, which is achieved using
   140      the following:</p>
   141  
   142      <ul>
   143        <li>set the value of <code class="directive"><a href="../mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code> to zero</li>
   144  
   145        <li>set the value of <code class="directive"><a href="../mod/mpm_common.html#maxsparethreads">MaxSpareThreads</a></code> to the same value as
   146        <code class="directive"><a href="../mod/mpm_common.html#maxclients">MaxClients</a></code></li>
   147      </ul>
   148  
   149      <p>A typical configuration of the process-thread controls in
   150      the <code class="module"><a href="../mod/worker.html">worker</a></code> MPM could look as follows:</p>
   151  
   152      <div class="example"><p><code>
   153        ServerLimit         16<br />
   154        StartServers         2<br />
   155        MaxClients         150<br />
   156        MinSpareThreads     25<br />
   157        MaxSpareThreads     75<br />
   158        ThreadsPerChild     25
   159      </code></p></div>
   160  
   161      <p>While the parent process is usually started as <code>root</code>
   162      under Unix in order to bind to port 80, the child processes and threads
   163      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
   164      the privileges of the Apache child processes. The child processes
   165      must be able to read all the content that will be served, but
   166      should have as few privileges beyond that as possible. In
   167      addition, unless <code class="program"><a href="../programs/suexec.html">suexec</a></code> is used,
   168      these directives also set the privileges which will be inherited
   169      by CGI scripts.</p>
   170  
   171      <p><code class="directive"><a href="../mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code>
   172      controls how frequently the server recycles processes by killing
   173      old ones and launching new ones.</p>
   174  </div>
   175  </div>
   176  <div class="bottomlang">
   177  <p><span>Available Languages: </span><a href="../de/mod/worker.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
   178  <a href="../en/mod/worker.html" title="English">&nbsp;en&nbsp;</a> |
   179  <a href="../ja/mod/worker.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
   180  <a href="../tr/mod/worker.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
   181  </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>
   182  <script type="text/javascript"><!--//--><![CDATA[//><!--
   183  var comments_shortname = 'httpd';
   184  var comments_identifier = 'http://httpd.apache.org/docs/2.2/mod/worker.html';
   185  (function(w, d) {
   186      if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
   187          d.write('<div id="comments_thread"><\/div>');
   188          var s = d.createElement('script');
   189          s.type = 'text/javascript';
   190          s.async = true;
   191          s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
   192          (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
   193      }
   194      else { 
   195          d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
   196      }
   197  })(window, document);
   198  //--><!]]></script></div><div id="footer">
   199  <p class="apache">Copyright 2017 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>
   200  <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.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[//><!--
   201  if (typeof(prettyPrint) !== 'undefined') {
   202      prettyPrint();
   203  }
   204  //--><!]]></script>
   205  </body></html>