What is all this memory used for?

October 10, 2018 323 views
Server Optimization DigitalOcean Ubuntu 16.04

In Virtualmin I got an overview of my running processes. I thought my 2GB server was more than enough - for application I use 512M is the recommended minimum. But when I see the statistics much of those 2GB is used. What is happening? Why is Digital Ocean consuming so much itself?

Real memory: 1.97 GB total / 993.90 MB free / 726.32 MB cached

1597 root 835.54 MB /usr/lib/snapd/snapd
1743 nobody 775.73 MB /opt/digitalocean/bin/do-agent -log_syslog
1621 clamav 598.76 MB /usr/sbin/clamd --foreground=true
1789 mysql 556.29 MB /usr/sbin/mysqld
1250 www-data 229.91 MB /usr/sbin/apache2 -k start
1251 www-data 229.80 MB /usr/sbin/apache2 -k start

2 Answers
unixynet October 10, 2018
Accepted Answer

I suspect those values are virtual memory usage not the actual memory being used right now. The difference is that, for example, the 835MB snapd is using includes the shared libraries, plus memory that's been swapped out, and unused memory. You'll need to run top like this from the command line to figure out the exact memory usage:

top -oRES -b -n1 |grep 'snapd\|do_agent\|clamd\|mysqld\|apache2'

Thank you for your answer. That explains a lot. It leaves one question: why is Digital Ocean using so much?

  • Virtualmin's showing do_agent is using 775.73 MB of virtual memory. That's a lot but try to find out how much physical memory it's using:

    top -b -n1|grep do_agent
    

    The 5th column will show you the physical memory in bytes.

Have another answer? Share your knowledge.