After a fresh install of a debian VPS, my system shows very low memory being used. I am not sure if this is even a issue. But according to 'free -m' My system is using only 21MB of RAM

             total       used       free     shared    buffers     cached
Mem:           512        510          1          0          0        488
-/+ buffers/cache:         21        490
Swap:          512        435         76

This is a small debian 7 VPS with 512MB RAM running postgresql/php/lighttpd

I am concerned because resource intensive queries are running in the background when the output shows only 21MB ram being used.

Even when postgresql is shutdown, free -m still shows the same. Infact the output of free -m hasn't changed much ever since the fresh install of the VPS took place.

Right now I am running lighttpd / postgresql / sphinxsearch / php etc.

So is such low RAM usage normal ?
If not what could be the possible reasons for this ?


Edit: I am talking about low RAM usage, and not high RAM usage as pointed in linux ate my RAM.

  • Out of curiosity here, what is swappiness set to? cat /proc/sys/vm/swappiness – Matt Apr 13 '15 at 19:43
  • Its set to just 0 – gyaani_guy Apr 14 '15 at 5:34
  • I think 512MB is far too little ram to be running so many things. Postgres would suck all of it. Upgrade your VPS. – Matt Apr 14 '15 at 20:12

I think you're misreading the memory usage a bit. Small actual memory usage can be normal, however in your case more is going on.

According to your "free -m" output:

The total memory is: 512 MB
Used memory: 510 MB
Free memory: 1 MB
Cached memory: 488 MB

Total swap: 512 MB
Used swap: 435 MB <-- Worry about that!
Free swap: 76 MB

Since you are using almost all of your swap your system is partially running from swap and performance may be severely degraded. Being worried is good in this case, but you're worried for the wrong reasons. Trust that the memory usage reported is correct, make sure to interpret it correctly.

In theory the free to use RAM could be 488 + 1 = 489MB, being the free and cached memory added up.

I think all these queries are eating up the memory in the form of cached memory (still available for processes though) and then most of the swap as well, which as I said will degrade performance. And what is the guarantee actual processes are not (partially) running from swap, or needing access to swappped memory?

Fix the query thing is my advice, and don't worry about whether the kernel reports memory usage correctly, I am fairly confident it is correct. :-)

| improve this answer | |
  • 1
    If it's an OpenVZ container, the reported memory usage is probably wrong. – Michael Hampton Apr 13 '15 at 19:37
  • Thanks for answering. It is an OpenVZ container, so the reported memory usage could be wrong ? I'll take your advice and worry about the queries. Thanks – gyaani_guy Apr 14 '15 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.