0

Possible Duplicate:
Meaning of the buffers/cache line in the output of free
Why is Linux reporting “free” memory strangely?

I have a 12GB RAM VPS where I host a a couple of static websites , 2 small Magento powered stores and a couple of WordPress installations - overall nothing exciting and generally low traffic.

I've noticed though that my memory consumption is quite high - kindly have a look at the results of free m below:

             total       used       free     shared    buffers     cached
Mem:      12306384   12137728     168656          0     753360    8629744
-/+ buffers/cache:    2754624    9551760
Swap:      1048564        104    1048460

Also see a screenshot out of Mumin http://s13.postimage.org/q2xewgnef/Screenshot_4.jpg

Now I reckon that 9,5 GB seem to be buffer / cache related - however I find this quite high. Is this something I have to worry about or will they eventually free themselves ? (I've read it somewhere but I am certainly not an expert)

Another note on the side is that Memcached has been installed once and applied to one of my Magento installation - could it be related to it?

Some expert advise would be truly appreciated.

1 Answers1

2

You walk into a factory and all the employees are working. "Why aren't employees sitting on a couch doing nothing?", you wonder. Well, duh, that's kind of dumb. The employees should be working, not sitting around waiting for work.

If you're thinking "I want the RAM to be free now so I can use it later", well that's dumb too. You don't need the RAM to be free now to use it later. You can use it now and use it later and get the best of both worlds.

It's not like if you use only 8GB today you can use 20GB tomorrow. Not using memory right now provides no advantage whatsoever, just opportunity lost forever. There is no cost associated with using memory that the system has and so no reason not to use as much of it as you possibly can.

Say the system did make more memory free. One of two things would happen:

  1. That memory wouldn't be used later. In which case, the effort of making it free would be completely wasted.

  2. That memory would be used later. In which case, the effort of making it free would be wasted, since it would just have to make it used again.

Modern operating systems only make memory free when they have absolutely no choice. It takes effort to do so, and that effort just has to be undone when the memory is used again. Instead, the memory is directly transitioned from one use to another without ever being free. Free memory is only needed for special use cases where memory cannot be transitioned from one use to another, such as in an interrupt context. Only a very small amount of free memory is needed for that purpose, typically 64MB or less.