Calculating average amount of memory used by each Apache process
You might need to calculate average amount of memory used by each Apache process for several reasons. One being deciding on
MaxRequestWorkers
.
You can do it by running:
ps -ylC httpd --sort:rss | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Process Size (MB): "x/((y-1)*1024)}'
Apache Memory Usage (MB): 390.312 Average Process Size (MB): 55.7589
But beware, this gives you the current average / usage. This might fluctuate during low / high traffic times of the day.
As a rule of thumb, you can calculate the maximum number of connections your server can handle by dividing the total available memory by the average amount of memory used by each Apache process