Difference between revisions of "Tune apache2 for more concurrent connections"
(Tune apache to increase the number of possible concurrent connections)
m (moved Development:Apache2 configuration to increase the number of possible simultaneously connections to Development:Tune apache2 for more concurrent connections: Shorter title.)
Revision as of 12:28, 23 May 2011
By default apache2 is configured to support about 150 concurrent connections. This forces all further connection requests to wait what is unnecessary since apache2 and the OX Server support a lot more concurrent connections on suitable hardware.
This is an example configuration to provide 800 concurrent connections. Please ensure that your apache is using the mpm_worker module. This allows us to serve lots of concurrent connections by using less RAM than with mpm_prefork as we are going to start much less processes.
<IfModule mpm_worker_module> ServerLimit 25 StartServers 10 MinSpareThreads 75 MaxSpareThreads 250 ThreadLimit 64 ThreadsPerChild 32 MaxClients 800 MaxRequestsPerChild 0 </IfModule>
Short explanation of the parameters:
|ServerLimit||Declares the maximum number of running apache processes. If you change this value you have to restart the daemon.|
|StartServers||The number of processes to start initially when starting the apache daemon.|
|MinSpareThreads/MaxSpareThreads||This regulates how many threads may stay idle without being killed. Apache regulates this on its own very well with default values.|
|ThreadsPerChild||How many threads can be created per process. Can be changed during a reload.|
|ThreadLimit||ThreadsPerChild can be configured as high as this value during runtime. If you change this value you have to restart the daemon.|
|MaxClients||This declares how many concurrent connections we provide. Devided by ThreadsPerChild you get the suitable ServerLimit value. May be less than ServerLimit * ThreadsPerChild to reserve some resources that can be engaged during runtime with increasing MaxClients and reloading the configuration.|
|MaxRequestsPerChild||Defines the number of Connections that a process can handle during its lifetime (keep-alives are counted once). After that it will be killed.|
For further information on these parameters see http://httpd.apache.org/docs/2.2/mod/worker.html and http://httpd.apache.org/docs/2.2/mod/mpm_common.html.
--Steffen.templin 12:10, 23 May 2011 (UTC)