I'm reading this article about Apache
mpm configuration tuning. And the author shows how to get the amount of Virtual Memory apache is using like this:
ps -A | grep apache
But this command shows me multiple apache processes:
11188 ? 00:01:36 apache2
17821 ? 00:00:02 apache2
23682 ? 00:00:00 apache2
23720 ? 00:00:00 apache2
23790 ? 00:00:01 apache2
23800 ? 00:00:00 apache2
23803 ? 00:00:00 apache2
23805 ? 00:00:01 apache2
23881 ? 00:00:00 apache2
23884 ? 00:00:00 apache2
23900 ? 00:00:00 apache2
Do I need to know how much memory single process uses or all of them to put in this formula:
Generally number of MaxClients=(Total RAM memory – RAM memory used for other process except Apache process) / (Memory used by Single Apache process)
It looks like I need to know the memory usage for a single process, but for which one out of the list?
Use the
top
command, and look at theRES
colum.Optionally, you can also use this command to get just that column for all Apache processes:
top -n 1 | grep apache2 | awk '{print $6}'
To get the average memory for all Apache processes, you can do the maths.
This Bash one-liner will get your average memory usage: