home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 May / Gamestar_62_2004-05_dvd.iso / Programy / apache_2.0.48-win32-x86-no_ssl.msi / Data.Cab / F252606_perchild.html.en < prev    next >
Extensible Markup Language  |  2003-05-29  |  17KB  |  261 lines

  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.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  5.               This file is generated from xml source: DO NOT EDIT
  6.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  7.       -->
  8. <title>perchild - Apache HTTP Server</title>
  9. <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
  10. <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
  11. <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
  12. <link href="../images/favicon.ico" rel="shortcut icon" /></head>
  13. <body>
  14. <div id="page-header">
  15. <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>
  16. <p class="apache">Apache HTTP Server Version 2.0</p>
  17. <img alt="" src="../images/feather.gif" /></div>
  18. <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
  19. <div id="path">
  20. <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Modules</a></div>
  21. <div id="page-content">
  22. <div id="preamble"><h1>Apache MPM perchild</h1>
  23. <div class="toplang">
  24. <p><span>Available Languages: </span><a href="../en/mod/perchild.html" title="English"> en </a></p>
  25. </div>
  26. <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Multi-Processing Module allowing for daemon processes serving
  27. requests to be assigned a variety of different userids</td></tr>
  28. <tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr>
  29. <tr><th><a href="module-dict.html#ModuleIdentifier">ModuleáIdentifier:</a></th><td>mpm_perchild_module</td></tr>
  30. <tr><th><a href="module-dict.html#SourceFile">SourceáFile:</a></th><td>perchild.c</td></tr></table>
  31. <h3>Summary</h3>
  32.  
  33.     <div class="warning">
  34.       This MPM does not currently work on most platforms.  Work is ongoing
  35.       to make it functional.
  36.     </div>
  37.  
  38.     <p>This Multi-Processing Module (MPM) implements a hybrid
  39.     multi-process, multi-threaded web server. A fixed number of
  40.     processes create threads to handle requests. Fluctuations in
  41.     load are handled by increasing or decreasing the number of
  42.     threads in each process.</p>
  43. </div>
  44. <div id="quickview"><h3 class="directives">Directives</h3>
  45. <ul id="toc">
  46. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#acceptmutex">AcceptMutex</a></li>
  47. <li><img alt="" src="../images/down.gif" /> <a href="#assignuserid">AssignUserID</a></li>
  48. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#bs2000account">BS2000Account</a></li>
  49. <li><img alt="" src="../images/down.gif" /> <a href="#childperuserid">ChildPerUserID</a></li>
  50. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#coredumpdirectory">CoreDumpDirectory</a></li>
  51. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#group">Group</a></li>
  52. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#listen">Listen</a></li>
  53. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#listenbacklog">ListenBacklog</a></li>
  54. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#lockfile">LockFile</a></li>
  55. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></li>
  56. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#maxsparethreads">MaxSpareThreads</a></li>
  57. <li><img alt="" src="../images/down.gif" /> <a href="#maxthreadsperchild">MaxThreadsPerChild</a></li>
  58. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#minsparethreads">MinSpareThreads</a></li>
  59. <li><img alt="" src="../images/down.gif" /> <a href="#numservers">NumServers</a></li>
  60. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#pidfile">PidFile</a></li>
  61. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#scoreboardfile">ScoreBoardFile</a></li>
  62. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#sendbuffersize">SendBufferSize</a></li>
  63. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#serverlimit">ServerLimit</a></li>
  64. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#startthreads">StartThreads</a></li>
  65. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#threadlimit">ThreadLimit</a></li>
  66. <li><img alt="" src="../images/right.gif" /> <a href="mpm_common.html#user">User</a></li>
  67. </ul>
  68. <h3>Topics</h3>
  69. <ul id="topics">
  70. <li><img alt="" src="../images/down.gif" /> <a href="#how-it-works">How it works</a></li>
  71. </ul><h3>See also</h3>
  72. <ul class="seealso">
  73. <li><a href="../bind.html">Setting which addresses and ports Apache
  74. uses</a></li>
  75. </ul></div>
  76. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  77. <div class="section">
  78. <h2><a name="how-it-works" id="how-it-works">How it works</a></h2>
  79.     <p>A single control process launches the number of child processes
  80.     indicated by the <code class="directive"><a href="#numservers">NumServers</a></code>
  81.     directive at server startup. Each child process creates threads as
  82.     specified in the <code class="directive"><a href="../mod/mpm_common.html#startthreads">StartThreads</a></code> directive.
  83.     The individual threads then
  84.     listen for connections and serve them when they arrive.</p>
  85.  
  86.     <p>Apache always tries to maintain a pool of <dfn>spare</dfn> or
  87.     idle server threads, which stand ready to serve incoming
  88.     requests. In this way, clients do not need to wait for new
  89.     threads to be created. For each child process, Apache assesses
  90.     the number of idle threads and creates or destroys threads to
  91.     keep this number within the boundaries specified by
  92.     <code class="directive"><a href="../mod/mpm_common.html#minsparethreads">MinSpareThreads</a></code>
  93.     and <code class="directive"><a href="../mod/mpm_common.html#maxsparethreads">MaxSpareThreads</a></code>.
  94.     Since this process is very self-regulating, it is rarely
  95.     necessary to modify these directives from their default values.
  96.     The maximum number of clients that may be served simultaneously
  97.     is determined by multiplying the number of server processes
  98.     that will be created (<code class="directive"><a href="#numservers">NumServers</a></code>) by the maximum
  99.     number of threads created in each process
  100.     (<code class="directive"><a href="../mod/mpm_common.html#maxthreadsperchild">MaxThreadsPerChild</a></code>).</p>
  101.  
  102.     <p>While the parent process is usually started as root under
  103.     Unix in order to bind to port 80, the child processes and
  104.     threads are launched by Apache as a less-privileged user. The
  105.     <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
  106.     set the privileges of the Apache child processes. The child
  107.     processes must be able to read all the content that will be
  108.     served, but should have as few privileges beyond that as
  109.     possible. In addition, unless <a href="../suexec.html">suexec</a> is used, these directives also
  110.     set the privileges which will be inherited by CGI scripts.</p>
  111.  
  112.     <p><code class="directive"><a href="../mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code>
  113.     controls how frequently the
  114.     server recycles processes by killing old ones and launching new
  115.     ones.</p>
  116.  
  117.     <h3><a name="user-ids" id="user-ids">Working with different user-IDs</a></h3>
  118.       <p>The <code class="module"><a href="../mod/perchild.html">perchild</a></code> MPM adds the extra ability to
  119.       specify that particular processes should serve requests under
  120.       different user-IDs. These user-IDs can then be associated with
  121.       specific virtual hosts. You have to use one <code class="directive"><a href="#childperuserid">ChildPerUserID</a></code> directive for
  122.       every user/group combination you want to be run. Then you can tie
  123.       particular virtual hosts to that user and group IDs.</p>
  124.  
  125.       <p>The following example runs 7 child processes. Two of them are run
  126.       under <code>user1</code>/<code>group1</code>. The next four are run
  127.       under <code>user2</code>/<code>group2</code> and the remaining
  128.       process uses 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>
  129.       of the main server:</p>
  130.  
  131.       <div class="example"><h3>Global config</h3><p><code>
  132.         NumServers 7<br />
  133.         ChildPerUserID user1 group1 2<br />
  134.         ChildPerUserID user2 group2 4
  135.       </code></p></div>
  136.  
  137.       <p>Using unbalanced numbers of processes as above is useful, if the
  138.       particular virtual hosts produce different load. The assignment to
  139.       the virtual hosts is easily done as in the example below. In
  140.       conclusion with the example above the following assumes, that
  141.       <code>server2</code> has to serve about twice of the hits of
  142.       <code>server1</code>.</p>
  143.  
  144.       <div class="example"><h3>Example</h3><p><code>
  145.         NameVirtualHost *<br />
  146.         <br />
  147.         <VirtualHost *><br />
  148.         <span class="indent">
  149.           ServerName fallbackhost<br />
  150.           # no assignment; use fallback<br />
  151.         </span>
  152.         </VirtualHost><br />
  153.         <br />
  154.         <VirtualHost *><br />
  155.         <span class="indent">
  156.           ServerName server1<br />
  157.           AssignUserID user1 group1<br />
  158.         </span>
  159.         </VirtualHost><br />
  160.         <br />
  161.         <VirtualHost *><br />
  162.         <span class="indent">
  163.           ServerName server2<br />
  164.           AssignUserID user2 group2<br />
  165.         </span>
  166.         </VirtualHost>
  167.       </code></p></div>
  168.     
  169. </div>
  170. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  171. <div class="directive-section"><h2><a name="AssignUserID" id="AssignUserID">AssignUserID</a> <a name="assignuserid" id="assignuserid">Directive</a></h2>
  172. <table class="directive">
  173. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Tie a virtual host to a user and group ID</td></tr>
  174. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AssignUserID <var>user-id</var> <var>group-id</var></code></td></tr>
  175. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host</td></tr>
  176. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
  177. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>perchild</td></tr>
  178. </table>
  179.     <p>Tie a virtual host to a specific user/group combination. Requests
  180.     addressed to the virtual host where this directive appears will be
  181.     served by a process running with the specified user and group ID.</p>
  182.  
  183.     <p>The user and group ID has to be assigned to a number of children
  184.     in the global server config using the <code class="directive"><a href="#childperuserid">ChildPerUserID</a></code> directive. See the section above for a
  185.     <a href="#user-ids">configuration example</a>.</p>
  186.  
  187. </div>
  188. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  189. <div class="directive-section"><h2><a name="ChildPerUserID" id="ChildPerUserID">ChildPerUserID</a> <a name="childperuserid" id="childperuserid">Directive</a></h2>
  190. <table class="directive">
  191. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify user ID and group ID for a number of child
  192. processes</td></tr>
  193. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ChildPerUserID <var>user-id</var> <var>group-id</var>
  194. <var>num-children</var></code></td></tr>
  195. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
  196. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
  197. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>perchild</td></tr>
  198. </table>
  199.     <p>Specify a user ID and group ID for a number of child processes.
  200.     The third argument, <var>num-children</var>, is the number of child
  201.     processes to start with the specified user and group. It does
  202.     <em>not</em> represent a specific child number. In order to use this
  203.     directive, the server must be run initially as <code>root</code>.
  204.     If you start the server as a non-root user, it will fail to change
  205.     to the lesser privileged user.</p>
  206.  
  207.     <p>If the total number of child processes, found by totaling all of the
  208.     third arguments to all <code class="directive">ChildPerUserID</code> directives
  209.     in the config file, is less than <code class="directive"><a href="#numservers">NumServers</a></code>, then all remaining children will inherit the
  210.     <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> settings from the main server.
  211.     See the section above for a <a href="#user-ids">configuration
  212.     example</a>.</p>
  213.  
  214.     <div class="warning"><h3>Security</h3>
  215.       <p>Don't set <var>user-id</var> (or <var>group-id</var>) to
  216.       <code>root</code> unless you know exactly what you are doing, and
  217.       what the dangers are.</p>
  218.     </div>
  219.  
  220. </div>
  221. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  222. <div class="directive-section"><h2><a name="MaxThreadsPerChild" id="MaxThreadsPerChild">MaxThreadsPerChild</a> <a name="maxthreadsperchild" id="maxthreadsperchild">Directive</a></h2>
  223. <table class="directive">
  224. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of threads per child process</td></tr>
  225. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxThreadsPerChild <var>number</var></code></td></tr>
  226. <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxThreadsPerChild 64</code></td></tr>
  227. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
  228. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
  229. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>perchild</td></tr>
  230. </table>
  231.     <p>This directive sets the maximum number of threads that will be
  232.     created in each child process. To increase this value beyond its
  233.     default, it is necessary to change the value of the <code class="directive"><a href="../mod/mpm_common.html#threadlimit">ThreadLimit</a></code> directive and stop and
  234.     re-start the server.</p>
  235.  
  236. </div>
  237. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  238. <div class="directive-section"><h2><a name="NumServers" id="NumServers">NumServers</a> <a name="numservers" id="numservers">Directive</a></h2>
  239. <table class="directive">
  240. <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Total number of children alive at the same time</td></tr>
  241. <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NumServers <var>number</var></code></td></tr>
  242. <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>NumServers 2</code></td></tr>
  243. <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
  244. <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
  245. <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>perchild</td></tr>
  246. </table>
  247.     <p>The <code class="directive">NumServers</code> directive determines the number
  248.     of children alive at the same time. This number should be large enough to
  249.     handle the requests for the entire site. To increase this value beyond the
  250.     value of <code>8</code>, it is necessary to change the value of the
  251.     <code class="directive"><a href="../mod/mpm_common.html#serverlimit">ServerLimit</a></code> directive and stop
  252.     and re-start the server. See the section above for a <a href="#user-ids">configuration example</a>.</p>
  253.  
  254. </div>
  255. </div>
  256. <div class="bottomlang">
  257. <p><span>Available Languages: </span><a href="../en/mod/perchild.html" title="English"> en </a></p>
  258. </div><div id="footer">
  259. <p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
  260. <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>
  261. </body></html>