Calculate total and average Apache process size

You can use this simple command or put it in executable script to check Apache memory usage per process and total:

ps -ylC apache2 | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'

2 Replies to “Calculate total and average Apache process size”

  1. wrong, your code example returns 0 MB used whereas my apache is up and running with numerous web-sites on it

  2. Thanks for the comment but to be honest the post is 4 years old and unfortunately it does not work in your case. I am sorry for this and I can not help you without more details. Anyway in my setup on Debian this code still works, but even I would not use my own reminder post that is 4 years old but search for newer solution.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.