-
-
Save tbjers/4496984 to your computer and use it in GitHub Desktop.
#!/bin/sh | |
available=$(free --mega -tw | grep "Total:" | awk '{print $4}') | |
ps -ylC httpd --sort:rss | awk -v avail="$available" '{ s += $8; } END { print "Average Size:", s/(NR-1)/1024, "MB,", NR-1, "Processes, Total usage:", (s/(NR-1)/1024)*(NR-1), "MB, Max Servers:", avail/(s/(NR-1)/1024) }' |
<IfModule prefork.c> | |
StartServers 10 | |
MinSpareServers 10 | |
MaxSpareServers 25 | |
ServerLimit 128 | |
MaxClients 128 | |
MaxRequestsPerChild 0 | |
</IfModule> |
$ free -m | |
total used free shared buffers cached | |
Mem: 7454 1405 6049 0 142 401 | |
-/+ buffers/cache: 860 6594 | |
Swap: 1023 0 1023 | |
$ ./check-apache-instances.sh | |
Average Size: 26.043 MB, 37 servers, Total usage: 963.59 MB, Max Servers: 249.588 |
Hi, great script. However, you'll need to account for the Header Line in the ps output. I modified your script by adding (NR-1) in the relevant locations. Thank you!
ps -ylC httpd --sort:rss | awk '{ s += $8; } END { print "Average Size:", s/(NR-1)/1024, "MB,", NR-1, "Processes, Total usage:", (s/(NR-1)/1024)*(NR-1), "MB, Max Servers:", 6500/(s/(NR-1)/1024) }'
how to get maxclient limit
I have 65 gb ram so what should be the maxclient ? i have already set maxclient to 900 but at some point it exceeds that value.
Thanks for the idea and script. I modified it a little to accept the actual free resources from the output of free -tw
#!/bin/sh
available=$(free --mega -tw | grep "Total:" | awk '{print $4}')
ps -ylC httpd --sort:rss | awk -v avail="$available" '{ s += $8; } END { print "Average Size:", s/(NR-1)/1024, "MB,", NR-1, "Processes, Total usage:", (s/(NR-1)/1024)*(NR-1), "MB, Max Servers:", avail/(s/(NR-1)/1024) }'
Thanks for the idea and script. I modified it a little to accept the actual free resources from the output of free -tw
#!/bin/sh available=$(free --mega -tw | grep "Total:" | awk '{print $4}') ps -ylC httpd --sort:rss | awk -v avail="$available" '{ s += $8; } END { print "Average Size:", s/(NR-1)/1024, "MB,", NR-1, "Processes, Total usage:", (s/(NR-1)/1024)*(NR-1), "MB, Max Servers:", avail/(s/(NR-1)/1024) }'
Thank you for this! I have updated the original script with your suggestion.
Hi i could not find the MaxClients 128 in the httpd.conf file in Appache xammp.
also this line to
can you please tell me what i am doing wrong..