I am currently using a linux server to host a web application. The server does not seem to use any memory for caching. I noticed this, because I had the feeling the machine is pretty slow. I thought it might run out of ram.

Having ssh access, I was able to execute "free -m", which shows me the following:

             total       used       free     shared    buffers     cached
Mem:          1536        244       1291          0          0          0
-/+ buffers/cache:        244       1291
Swap:            0          0          0

In my opinion, normally it should use about 90% of its free memory for caching. I've never seen this before.

What might me the problem here?

BTW: It seems to be a RedHat. I don't know too much about RedHat, because I am more a Debian guy.

  • You need to tell us more about the specifics of your web application. Is it designed to utilize caching ? If this is a server question, it might belong on serverfault.com. – driis Nov 26 '09 at 16:41
  • Very strange behaviour. Check the mount options of your filesystems. – Gunther Piez Nov 26 '09 at 16:48

You're on an OpenVZ or Virtuozzo VM. Confirm by looking for a file /proc/user_beancounters or a directory /proc/bc; if one (or both) of those are there, it's an OpenVZ/Virtuozzo VM for sure (those locations only exist in those VM types). If it's not there, their existence might have been patched out of the VM environment you're in (some extra-unscrupulous providers do that to try and hide their dodginess, but having no cache or buffers is a giveaway). If you have been sold a physical machine, you've been sold a dud.

| improve this answer | |
  • 2
    It is a good idea to check /proc/bc/ directory also, since user_beancounters was deprecated some time ago (I'm unsure if it was/when it will be removed). – Juliano Nov 26 '09 at 18:22
  • @Juliano: Shows how long it's been since I admined a cluster of VZ machines. Thanks, answer updated. – womble Nov 26 '09 at 18:32
  • Thanks! That's it. Fortunately I did not buy anything. I just have to host my application on a server, which is owned by the customer and it is pretty slow sometimes. I was hoping to find a server configuration problem, so the customer could fix it. – user27352 Nov 27 '09 at 9:42
  • 1
    The "configuration problem" is that it's a ridiculously overloaded VZ VM; it's easy to run those things with far too many customers on them, leading to poor (and intermittent) performance. I'd be strongly recommending to my customer that they switch to a provider who doesn't run VZ. – womble Nov 27 '09 at 18:39

Have a look in /proc/sys/vm/pagecache.

That file controls how much memory the kernel will use for file system cacheing.

| improve this answer | |

That's not what the output of free means

IIRC cached is the amount of swap that is still cached in memory.

| improve this answer | |
  • You remember incorrectly. – womble Nov 26 '09 at 17:33
  • The amount of data that is present in both swap space and RAM is the SwapCached count seen in /proc/meminfo (and not displayed by free) – David Spillett Nov 26 '09 at 18:01

Your Answer

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