Apache performace tunning

Ref: http://httpd.apache.org/docs/2.2/mod/prefork.html

Ref:http://www.devside.net/articles/apache-performance-tuning

Ref:http://en.wikipedia.org/wiki/Slowloris

Sample Configuration for prefork setting

<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

StartServers :

The StartServers directive sets the number of child server processes created on startup. So after restart the apache if we take a snapshot of how many process is running

[root@mail extra]# ps aux | grep -v grep | grep httpd
daemon 5384 0.0 0.7 15788 7532 ? S 17:45 0:00 /usr/local/apache/bin/httpd -k start
daemon 5385 0.0 0.7 15788 7532 ? S 17:45 0:00 /usr/local/apache/bin/httpd -k start
daemon 5386 0.0 0.7 15788 7532 ? S 17:45 0:00 /usr/local/apache/bin/httpd -k start
daemon 5387 0.0 0.7 15788 7532 ? S 17:45 0:00 /usr/local/apache/bin/httpd -k start
daemon 5388 0.0 0.7 15788 7532 ? S 17:45 0:00 /usr/local/apache/bin/httpd -k start
root 13326 0.0 0.8 15788 8596 ? Ss Nov07 0:00 /usr/local/apache/bin/httpd -k start
[root@mail extra]# ps aux | grep -v grep | grep httpd | wc -l
6

so after restart the server, its start of with 5 child process

MinSpareServer:

The MinSpareServers directive sets the desired minimum number of idle child server processes. An idle process is one which is not handling a request.

MaxSpareServers:

The MaxSpareServers directive sets the desired maximum number of idle child server processes. An idle process is one which is not handling a request. If there are more than MaxSpareServers idle, then the parent process will kill off the excess processes.

Extra Note :

Here By setting MinSpareServer and MaxSpareServer, we are telling apache how many child process would be idle at a time. According to the above configuration there would be always minimum of 5 Child process would be ide .So , now if 5 child process is busy,t hen apache will create another 5 child process so it would be 5+5=10 child process, 5 is busy and 5 is idle. Now if all of them 10 child process is busy, apache will create another 5 child process,so total child process would be 5+5+5=15. apache will create child process till 150 , because Maximum client is set to 150

Tags: , , ,

Leave a Reply