Hello I need some help please to set the values for server limit and max clients so my server can accept more users/connections. My server: 2x Intel Xeon Quad 5405 16 GB DDR2 RAM And i use apache and prefork - (default prefork settings) apache settings: StartServers 15 MinSpareServers 15 MaxSpareServers 25 ServerLimit 512 MaxClients 384 MaxRequestsPerChild 1000 KeepAlive on KeepAliveTimeout 3 MaxKeepAliveRequests 100 TimeOut 100 and i test it also with keep alive off. I use only one account on my cpanel server (one forum only inside) and i use nginx in front of apache as proxy. From the top i have about 6gb ram free. Can you please help me to adjust it a bit so i will be able to handle more users/connections? Thank you
This is what i can see for apache status when i have many users online: Current Time: Sunday, 06-Mar-2011 22:17:01 EET Restart Time: Wednesday, 02-Mar-2011 00:41:16 EET Parent Server Generation: 14 Server uptime: 4 days 21 hours 35 minutes 45 seconds Total accesses: 4720738 - Total Traffic: 422.0 GB CPU Usage: u622.74 s40.01 cu0 cs0 - .157% CPU load 11.2 requests/sec - 1.0 MB/second - 93.7 kB/request 6 requests currently being processed, 226 idle workers ____..__._._.______________._____...__.____.__.__.___...__..C_._ ____W_..__.____.._.._..____._______...__.___.___.._W._..___.____ ._..._.__._____W___.___.__..__.___.____..._.__._.___._.______.__ __.._._._.___.___.__._..___.___._____W_W_.._..____.._____.______ ._____...__.__.___.____.._______.___.____________._.__._.__.____ _____.._...__................................................... ................................................................ ................................................................ Scoreboard Key: "_" Waiting for Connection, "S" Starting up, "R" Reading Request, "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup, "C" Closing connection, "L" Logging, "G" Gracefully finishing, "I" Idle cleanup of worker, "." Open slot with no current process Keep alive off I have many waiting and many idle and i don't know if it is normal as with this stats i got a spike on the server load for a few seconds and then is ok. 226 idle workers i think are a lot. I can see also x3 of these compared with the normal usage after or before a few seconds. /usr/local/apache/bin/httpd -k start -DSSL ?
Do you have problems with site responsiveness and load time? It seems that 226 idle is a lot. To calculate the optimal MaxClients value, look how match httpd processes now and what value size means there (column RSS in ps output): ps -ylC httpd --sort:rss Then look at the current free memory. Part of free memory should be saved for other services. MaxClients = The remainder of the free memory is divided by mean value http proccess size Also check monitoring system parameters like CPU and disks on the server load moment, for example with top, vmstat, iotop utility to find possible bottlenecks.
Not at all. And this is why i am looking for 356 idle workers why the server start so many for a few seconds. Also i notice at this time that my firewall csf is using a lot of cpu to check all ip's for more than 300 connections to ban them.
KeepAlive On MaxKeepAliveRequests 150 KeepAliveTimeout 5 <IfModule prefork.c> StartServers 20 MinSpareServers 20 MaxSpareServers 40 ServerLimit 450 MaxClients 450 MaxRequestsPerChild 1000 </IfModule> <IfModule worker.c> ServerLimit 18 StartServers 8 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxClients 450 MaxRequestsPerChild 1000 </IfModule> Timeout 300 Code (markup):
You may to watch the server in top utility to see what process is up to when you believe performance is being affected. IF it is, then you'll need to tweak csf.conf appropriately to check ip-address's less and/or frequently. Or you may write iptables+ipset rules for this task.