The server runs well but I wonder if I should get more RAM. I only have a few MB of "free" memory and 1.2GB of "cached" memory:


             total       used       free     shared    buffers     cached
Mem:          3945       3893         51          0         28       1216
-/+ buffers/cache:       2648       1296
Swap:         3895        857       3038

I learned that cached memory is used while it's free and not.

Is the cached value an indicator for the need of more RAM?

cat /proc/meminfo 1 day after flushing the cache:

MemTotal:      4040048 kB
MemFree:         32844 kB
Buffers:         18956 kB
Cached:        1249092 kB
SwapCached:     161576 kB
Active:        3611328 kB
Inactive:       189104 kB
SwapTotal:     3989496 kB
SwapFree:      2894200 kB
Dirty:           20520 kB
Writeback:           0 kB
AnonPages:     2523496 kB
Mapped:         217744 kB
Slab:            70940 kB
SReclaimable:    36756 kB
SUnreclaim:      34184 kB
PageTables:      99648 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   6009520 kB
Committed_AS:  6401716 kB
VmallocTotal: 34359738367 kB
VmallocUsed:     18852 kB
VmallocChunk: 34359719439 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
HugePages_Surp:      0
Hugepagesize:     2048 kB


top - 17:20:10 up 112 days,  3:06,  1 user,  load average: 1.01, 1.62, 1.48
Tasks: 208 total,   1 running, 207 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.6%us,  0.6%sy,  0.0%ni, 97.5%id,  1.3%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   4040048k total,  3953108k used,    86940k free,    16348k buffers
Swap:  3989496k total,  1095712k used,  2893784k free,  1235436k cached
  • linuxatemyram.com – MDMarra Nov 3 '12 at 16:57
  • Check the value of /proc/sys/vm/swapiness, try setting it to 0. That should reduce the use of swap, otoh the page cache will shrink. – ott-- Nov 3 '12 at 18:56

The cached value is not an indicator that you may need more ram - free ram is wasted ram, so the system will always try to fill any otherwise unused ram with cache.

You are using a lot of swap, which could be an indicator that more ram might be useful, but you say the system runs well, so it's probably fine.


You have 1296MB of memory free for your applications to use (check the -/+ buffers/cache: line).

I cannot tell you if you need more ram, you know your usage.

Linux caches files from disk to ram, to get better (faster) data access times. Linux will use all your free (unused by applications) RAM to cache data from disk - even if you have ridiculus ammounts of RAM, it will use it up by caching data from the hard drive. When that RAM is needed for application use, it will dump some old cached data, and give that ram to the application that needs it.

  • Ok so I don't need more RAM yet. But getting more wouldn't hurt, since it could cache more data which would be improve the performance. – Martin Nov 3 '12 at 16:28
  • @Martin: To say that it will increase the performance is a bit premature. It certainly could, but if does depends on your use pattern. It's quite certain however that is won't hurt :) – Sven Nov 3 '12 at 17:51

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.