Apache MaxClients doubt
Posted
by Milan Babuškov
on Server Fault
See other posts from Server Fault
or by Milan Babuškov
Published on 2010-05-16T16:24:03Z
Indexed on
2010/05/16
16:30 UTC
Read the original article
Hit count: 364
I have a busy Apache server serving only dynamic PHP+MySQL pages. It is a prefork Apache, version 2.2.4 with following config:
KeepAlive off
StartServers 8
MinSpareServers 32
MaxSpareServers 64
ServerLimit 512
MaxClients 512
MaxRequestsPerChild 4000
MaxClients/ServerLimit used to be set to 256, but I got the following error in error_log so I increased it:
[error] server reached MaxClients setting, consider raising the MaxClients setting
It seems to work now, but I have a doubt. Looking at MySQL log of queries, I have a couple hundred clients per seconds, but "ps ax" only shows 8, 9 or 10 processes running:
[root@engine ~]# ps ax | grep http | wc -l
10
I even got this many processes when the above error message was shown in error_log. This made me investigate further. When I run netstat -a, I get something like this:
tcp 0 0 engine:http adsl-105-143.teol.net:21453 TIME_WAIT
tcp 0 0 engine:http 118-36.static.kds:mck-ivpip TIME_WAIT
tcp 0 0 engine:http 118-36.static:oce-snmp-trap TIME_WAIT
tcp 0 0 engine:http 118-36.static.kd:unifyadmin TIME_WAIT
tcp 0 0 engine:http cable-188-2-25-29.dyna:4906 TIME_WAIT
tcp 0 0 engine:http adsl-105-143.teol.net:21458 TIME_WAIT
tcp 0 0 engine:http 109-92-83-91.dynamic.:62821 TIME_WAIT
tcp 0 0 engine:http cable-89-216-142-192.:63576 TIME_WAIT
tcp 0 0 engine:http 109-92-83-91.dynamic.:62819 TIME_WAIT
tcp 1081 0 engine:http pttnetadsl38-36.ptt.r:50496 ESTABLISHED
tcp 0 0 engine:http cable-188-2-36-196.dyn:4136 TIME_WAIT
tcp 0 0 engine:http cable-89-216-142-192.:63580 TIME_WAIT
tcp 0 0 engine:http cable-89-216-142-192.:63581 TIME_WAIT
etc.
When counting those, I get:
[root@engine ~]# netstat -a | grep http | wc -l
431
Can anyone tell me what is really going on here and how to make sure my server keeps working, because I only use 50% of available RAM in machine?
© Server Fault or respective owner