3

I have a LAMP server with following configuration.

CPU : Intel(R) Xeon(R) CPU

RAM : 32 GB

HDD : 80 GB

Running on virtual environment.

All the things in the server are running smoothly. But I have noticed that the RAM usage is the server is increasing each day without any reason.

This is the current memory usage on my server.

# free -g
             total       used       free     shared    buffers     cached
Mem:            31         13         17          0          0         10
-/+ buffers/cache:          1         29
Swap:            2          0          2

And you can see the last 8 weeks memory usage below. https://i.stack.imgur.com/543jh.png

And i have executed the following command to find how much memory each process is consuming.

# ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'
         0.00 Mb COMMAND 
      2253.62 Mb /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock 
      1171.66 Mb java -jar /etc/vmagent/bin/VMAgent.jar 
       138.27 Mb /sbin/audispd 
       127.75 Mb /usr/sbin/named -u named -c /etc/named.conf -u named -t /var/named/run-root 
        74.29 Mb auditd 
        73.03 Mb automount 
        43.14 Mb /usr/bin/spamd --username=popuser --daemonize --nouser-config --helper-home-dir=/var/qmail --max-children 5 --create-prefs --virtual-config-dir=/var/qmail/mailnames/%d/%l/.spamassassin --pidfile=/var/run/spamd/spamd_full.pid --socketpath=/tmp/spamd_full.sock 
        43.14 Mb spamd child 
        43.14 Mb spamd child 
        37.13 Mb /usr/sbin/httpd 
        37.02 Mb /usr/sbin/httpd 
        36.52 Mb /usr/sbin/httpd 
        36.46 Mb /usr/sbin/httpd 
        36.23 Mb /usr/sbin/httpd ................

For troubleshooting , i have restarted the MySQL and APACHE servers. But the result was same. Restarting the entire server will fix the issue, but i want to know what is the real issue.

Let me know if you have any idea about this issue.

Thanks,

Arun S

1
  • 1
    Please read linuxatemyram.com This explains your problems (or lack thereof).
    – Sven
    Feb 21, 2012 at 10:28

3 Answers 3

3

-/+ buffers/cache: 1

You're using only 1 GB. The rest is system cache.

7

This is perfectly normal. If you want memory not to be used, take it out of the server and put it on your desk. Free memory is wasted memory.

Linux, like most modern operating systems, can directly transition memory from one use to another. Making it free in the middle has costs associated with it and no benefits associated with it. So sensible operating systems don't do it unless they have to.

Free memory is only needed for certain very specific cases. For example, free memory is needed to hold data received over the network temporarily until the OS can process it. Because free memory has a high cost associated with it (it's as if that memory wasn't there as far as performance goes) the system only keeps as much memory free as it needs for these special situations.

2
  • "put it on your desk" lol - reminds me of the top review for the Hulzer 571 Banana slicer. Now there's an invention far more useful than RAM. amazon.com/Hutzler-5717-571-Banana-Slicer/dp/B0047E0EII/… Dec 6, 2012 at 11:03
  • 2
    I have one of those and I love it. I used to eat bananas whole but was concerned people would stare at me because that just looks wrong. Now, I slice them, hold my thumb and index finger in a V, and smash each slice into the bottom of the V in front of my face and then lick the banana out. It feels much more natural. Dec 6, 2012 at 11:29
1

Read on this: Linux Ate My RAM

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .