Httpd worker MPM Configuration: Difference between revisions
No edit summary |
No edit summary |
||
Line 47: | Line 47: | ||
MaxClients (12) is not an integer multiple of ThreadsPerChild (10), lowering MaxClients to 10 | MaxClients (12) is not an integer multiple of ThreadsPerChild (10), lowering MaxClients to 10 | ||
</pre> | </pre> | ||
=ServerLimit= | |||
* http://httpd.apache.org/docs/current/mod/mpm_common.html#serverlimit | |||
Upper limit on configurable number of httpd processes. Default is 16. It is a hard limit, any attempts to change this directive during a restart will be ignored. | |||
Note: if ServerLimit is n, ps will show n + 2 server processes. For a ServerLimit value of 1: | |||
<pre> | |||
[webr@rangiroa ~]$ ps -ef | grep httpd | |||
root 7535 1 0 11:15 ? 00:00:00 /home/webr/httpd-2.2.21-worker/bin/httpd -k start | |||
webr 7536 7535 0 11:15 ? 00:00:00 /home/webr/httpd-2.2.21-worker/bin/httpd -k start | |||
webr 7537 7535 0 11:15 ? 00:00:00 /home/webr/httpd-2.2.21-worker/bin/httpd -k start | |||
</pre> | |||
The first one (7535) is root-owned, <font color=red>the second one (7536) is ? </font> and the third one (7537) is the actual child. | |||
If [[#ServerLimit|ServerLimit]] is set to a value much higher than necessary, unused shared memory will be allocated. If both [[#ServerLimit|ServerLimit]] and [[#MaxClients |MaxClients]] are set to values higher than the system can handle, Apache may not start or the system may become unstable. | |||
Use this directive only if your [[#MaxClients|MaxClients]] and [[#ThreadsPerChild|ThreadsPerChild]] settings require more than 16 server processes (default). Do not set the value of this directive any higher than the number of server processes required by what you may want for [[#MaxClients|MaxClients]] and [[#ThreadsPerChild|ThreadsPerChild]]. | |||
=ThreadsPerChild= | =ThreadsPerChild= | ||
Line 55: | Line 77: | ||
=MaxSpareThreads= | =MaxSpareThreads= | ||
=ThreadLimit= | =ThreadLimit= | ||
=ListenBacklog= | =ListenBacklog= |
Revision as of 02:39, 2 January 2017
Internal
Overview
Diagram
The configuration elements described below are represented on the mod_jk Concepts Diagram.
Enabling woker MPM Mode
If you configure httpd yourself, make sure you compiled it with worker MPM support.
If you use Red Hat EWS, worker support comes pre-compiled into $APACHE_HOME/sbin/httpd.worker, make sure the start script is using that.
For more details about compiling httpd with the right MPM mode, see:
MaxClients, MaxRequestWorkers
- http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients
- http://httpd.apache.org/docs/current/mod/mpm_common.html#maxrequestworkers
"MaxClients" and "MaxRequestWorkers" are equivalent, since 2.3.13 "MaxClients" was renamed "MaxRequestWorkers", but for the time being, both names are valid and supported.
MaxClients represents the maximum number of connections that will be processed simultaneously by the entire server, seen as the sum of all active children processes. The default value is 400 = 16 (ServerLimit) * 25 (ThreadsPerChild). The directive restricts the total number of threads that will be available to serve clients.
Any connection attempts over the MaxClients limit will normally be queued, up to a number based on the ListenBacklog directive. Once a child process becomes available after handling at least one of its current requests, the connection will then be serviced.
Even if ServerLimit is set to a high value (ThreadsPerChild left to default), the number of concurrent connection is limited by MaxClients. This was tested and proven.
MaxClients Idiosyncrasies
- MaxClients must be at least equals with ThreadsPerChild. If not, httpd will warn at startup and automatically adjust the value to be equals with ThreadsPerChild.
- MaxClients must be an integer multiple of ThreadsPerChild. If it's not, it will be adjusted automatically, and the server will issue an error message similar to the one presented below:
MaxClients (12) is not an integer multiple of ThreadsPerChild (10), lowering MaxClients to 10
ServerLimit
Upper limit on configurable number of httpd processes. Default is 16. It is a hard limit, any attempts to change this directive during a restart will be ignored.
Note: if ServerLimit is n, ps will show n + 2 server processes. For a ServerLimit value of 1:
[webr@rangiroa ~]$ ps -ef | grep httpd root 7535 1 0 11:15 ? 00:00:00 /home/webr/httpd-2.2.21-worker/bin/httpd -k start webr 7536 7535 0 11:15 ? 00:00:00 /home/webr/httpd-2.2.21-worker/bin/httpd -k start webr 7537 7535 0 11:15 ? 00:00:00 /home/webr/httpd-2.2.21-worker/bin/httpd -k start
The first one (7535) is root-owned, the second one (7536) is ? and the third one (7537) is the actual child.
If ServerLimit is set to a value much higher than necessary, unused shared memory will be allocated. If both ServerLimit and MaxClients are set to values higher than the system can handle, Apache may not start or the system may become unstable.
Use this directive only if your MaxClients and ThreadsPerChild settings require more than 16 server processes (default). Do not set the value of this directive any higher than the number of server processes required by what you may want for MaxClients and ThreadsPerChild.