What is using up all of my server’s RAM?

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.

James Lee
James Lee

James Lee, a seasoned leader with 15+ years in the tech industry, leverages his Cloud expertise to drive innovative solutions and exceptional customer experiences. He identifies growth opportunities through keen market insights and user behavior analysis, navigating the complexities of the Cloud landscape. A skilled communicator and collaborator, James thrives on exceeding expectations and leading teams to deliver impactful products.

Leave a Reply

Your email address will not be published. Required fields are marked *