]> granicus.if.org Git - apache/blob - docs/manual/mod/prefork.xml
remove references to BS2000Account.
[apache] / docs / manual / mod / prefork.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <modulesynopsis metafile="prefork.xml.meta">
5
6 <name>prefork</name>
7 <description>Implements a non-threaded, pre-forking web server</description>
8 <status>MPM</status>
9 <sourcefile>prefork.c</sourcefile>
10 <identifier>mpm_prefork_module</identifier>
11
12 <summary>
13     <p>This Multi-Processing Module (MPM) implements a non-threaded,
14     pre-forking web server that handles requests in a manner similar
15     to Apache 1.3.  It is appropriate for sites that need to avoid
16     threading for compatibility with non-thread-safe libraries.  It
17     is also the best MPM for isolating each request, so that a problem
18     with a single request will not affect any other.</p>
19
20     <p>This MPM is very self-regulating, so it is rarely necessary to
21     adjust its configuration directives.  Most important is that
22     <directive module="mpm_common">MaxClients</directive> be big enough to 
23     handle as many simultaneous requests as you expect to receive, but
24     small enough to assure that there is enough physical RAM for all
25     processes.</p>
26 </summary>
27 <seealso><a href="../bind.html">Setting which addresses and ports Apache
28 uses</a></seealso>
29
30 <section id="how-it-works"><title>How it Works</title>
31     <p>A single control process is responsible for launching child
32     processes which listen for connections and serve them when they
33     arrive. Apache always tries to maintain several <dfn>spare</dfn>
34     or idle server processes, which stand ready to serve incoming
35     requests. In this way, clients do not need to wait for a new
36     child processes to be forked before their requests can be
37     served.</p>
38
39     <p>The <directive module="mpm_common">StartServers</directive>,
40     <directive module="prefork">MinSpareServers</directive>,
41     <directive module="prefork">MaxSpareServers</directive>, and
42     <directive module="mpm_common">MaxClients</directive> regulate how
43     the parent process creates children to serve requests. In general,
44     Apache is very self-regulating, so most sites do not need to
45     adjust these directives from their default values. Sites which
46     need to serve more than 256 simultaneous requests may need to
47     increase <directive module="mpm_common">MaxClients</directive>,
48     while sites with limited memory may need to decrease <directive
49     module="mpm_common">MaxClients</directive> to keep the server from
50     thrashing (swapping memory to disk and back). More information
51     about tuning process creation is provided in the <a
52     href="../misc/perf-tuning.html">performance hints</a>
53     documentation.</p>
54
55     <p>While the parent process is usually started as <code>root</code>
56     under Unix in order to bind to port 80, the child processes are
57     launched by Apache as a less-privileged user. The <directive
58     module="mpm_common">User</directive> and <directive
59     module="mpm_common">Group</directive> directives are used to set
60     the privileges of the Apache child processes. The child processes
61     must be able to read all the content that will be served, but
62     should have as few privileges beyond that as possible.</p>
63
64     <p><directive module="mpm_common">MaxRequestsPerChild</directive>
65     controls how frequently the server recycles processes by killing
66     old ones and launching new ones.</p>
67 </section>
68
69 <directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
70 </directivesynopsis>
71 <directivesynopsis location="mpm_common"><name>PidFile</name>
72 </directivesynopsis>
73 <directivesynopsis location="mpm_common"><name>Listen</name>
74 </directivesynopsis>
75 <directivesynopsis location="mpm_common"><name>ListenBacklog</name>
76 </directivesynopsis>
77 <directivesynopsis location="mpm_common"><name>LockFile</name>
78 </directivesynopsis>
79 <directivesynopsis location="mpm_common"><name>MaxClients</name>
80 </directivesynopsis>
81 <directivesynopsis location="mpm_common"><name>MaxMemFree</name>
82 </directivesynopsis>
83 <directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
84 </directivesynopsis>
85 <directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
86 </directivesynopsis>
87 <directivesynopsis location="mpm_common"><name>SendBufferSize</name>
88 </directivesynopsis>
89 <directivesynopsis location="mpm_common"><name>ServerLimit</name>
90 </directivesynopsis>
91 <directivesynopsis location="mpm_common"><name>StartServers</name>
92 </directivesynopsis>
93 <directivesynopsis location="mpm_common"><name>User</name>
94 </directivesynopsis>
95 <directivesynopsis location="mpm_common"><name>Group</name>
96 </directivesynopsis>
97 <directivesynopsis location="mpm_common"><name>AcceptMutex</name>
98 </directivesynopsis>
99
100 <directivesynopsis>
101 <name>MaxSpareServers</name>
102 <description>Maximum number of idle child server processes</description>
103 <syntax>MaxSpareServers <var>number</var><br /></syntax>
104 <default>MaxSpareServers 10</default>
105 <contextlist><context>server config</context></contextlist>
106
107 <usage>
108     <p>The <directive>MaxSpareServers</directive> directive sets the
109     desired maximum number of <em>idle</em> child server processes. An
110     idle process is one which is not handling a request. If there are
111     more than <directive>MaxSpareServers</directive> idle, then the
112     parent process will kill off the excess processes.</p>
113
114     <p>Tuning of this parameter should only be necessary on very
115     busy sites. Setting this parameter to a large number is almost
116     always a bad idea. If you are trying to set the value lower than
117     <directive module="prefork">MinSpareServers</directive>, Apache
118     will automatically adjust it to <directive
119     >MinSpareServers</directive><code> + 1</code>.</p>
120 </usage>
121 <seealso><directive module="prefork">MinSpareServers</directive></seealso>
122 <seealso><directive module="mpm_common">StartServers</directive></seealso>
123 </directivesynopsis>
124
125 <directivesynopsis>
126 <name>MinSpareServers</name>
127 <description>Minimum number of idle child server processes</description>
128 <syntax>MinSpareServers <var>number</var></syntax>
129 <default>MinSpareServers 5</default>
130 <contextlist><context>server config</context></contextlist>
131
132 <usage>
133     <p>The <directive>MinSpareServers</directive> directive sets the
134     desired minimum number of <em>idle</em> child server processes. An
135     idle process is one which is not handling a request. If there are
136     fewer than <directive>MinSpareServers</directive> idle, then the parent
137     process creates new children at a maximum rate of 1 per second.</p>
138
139     <p>Tuning of this parameter should only be necessary on very
140     busy sites. Setting this parameter to a large number is almost
141     always a bad idea.</p>
142 </usage>
143 <seealso><directive module="prefork">MaxSpareServers</directive></seealso>
144 <seealso><directive module="mpm_common">StartServers</directive></seealso>
145 </directivesynopsis>
146
147 </modulesynopsis>
148