A couple of days ago I started to do some optimizations on our server backends. Most of them are Apache-Prefork PHP powered.
One part of doing Apache-Tuning is to play around with the MPM configuration:
7
MaxRequestsPerChild
10000
The particular configuration setting for Apache can be found in the file /etc/apache/httpd.conf
I’m using Webmin->Sysstats to get some basic data where I can start from.
First I wanted to know the average and total memory usage of the apache worker process(es).
Apache memory consumption (total, per worker)
As you can see after a few days you get a clew about how our worker memory consumption behaves.
Especially the per worker chart is import which gives you a hint for the MaxClients and ServerLimit settings.
The used bash script :
2
ps
-ylC apache2 |
awk
'{x += $8;y += 1} END {print x/((y-1)*1024)}'
;;
3
-getApacheTotalMemPercent)
4
sys_mem=`
free
-m |
awk
'NR==2{print $2 }'
`
5
apache_total_mem=`
ps
-ylC apache2 |
awk
'{x += $8;y += 1} END {print x/1024;}'
`
6
echo
"scale=2;$apache_total_mem/($sys_mem/100)"
|
bc
;;
Another important part is the relation of idle and busy workers.
Apache amount and relation of busy/idle workers
Here we see that in this particular case we have an average ratio 10/2 (idle /busy ) and our max is about (11/7) which gives a balanced amount of idle and busy workers.
The used bash script :
2
echo
`wget -q -O -
"$URL"
--user=
"$USER"
--password=$PASS |
grep
BusyWorker |
cut
-d
" "
-f2`;;
4
echo
`wget -q -O -
"$URL"
--user=
"$USER"
--password=$PASS |
grep
IdleWorker |
cut
-d
" "
-f2`;;
have fun
Mario
About cool/interesting Projects and Technologies