Have your server ever ran out of RAM / Memory? Do you even know if your server ran out of Memory?
You will know that you are running out of Memory if you receive an Out of Memory (OOM) notification from your server or if you have server monitoring tools setup to monitor your CPU, RAM and other usages.
If you do not have a monitoring tool setup to monitor your server, I highly recommend Hetrixtools which offers a comprehensive server monitoring tool for free. You can use my referral link to receive 3 extra Uptime/Server Monitors (making it a total of 18 free monitors).
Now I’m sure that you know how to find out the current RAM usage of your server (Hint: use the free -m
command), but do you know what services are consuming your server’s Memory?
What services are consuming your server’s Memory?
To check what services are consuming the RAM of a Linux server like CentOS / CloudLinux / AlmaLinux, run this SSH command:-
ps -eo comm,rss|awk '{arr[$1]+=$2} END {for (i in arr) {print arr[i]/1024, i}}'|grep -v '^0 '|sort -n -r
You will see a list of services along with their RAM usage in descending order.
Do note that you will need root access to the server in order to run this command.