0

We have a Linux server for which Cacti's memory usage graph reports decreasing cache size until the server eventually runs out of memory. Free memory remains low throughout, which is normal for Linux. I would expect cache size to remain roughly constant over time, and I'm trying to think of what might possibly be going on with this.

I assume that a kernel memory leak is not a likely issue.

I also saw this, which says that saving to a tmpfs filesystem is a possibility:

In Linux, what is the difference between "buffers" and "cache" reported by the free command?

Any others I should be looking at?

2 Answers2

1

A reduction in cache, assuming your free memory and buffers stays the same, just means that some process on the system was judged to need it more (in technical terms, the "working set" of memory pages for the processes running on the system grew larger, so the kernel needs to keep more pages in main memory).

womble
  • 95,029
  • 29
  • 173
  • 228
  • 3
    Actually memory used by tmpfs filesystems is usually counted in the cached value, so _deleting_ things from tmpfs filesystems, not adding them, will make the amount of cache `free` shows drop (and it will initially be counted at free rather then used, until something else grabs the memory). – David Spillett Nov 25 '09 at 16:05
  • 1
    Holy moley, you're right. Create a big file on a tmpfs and cache usage shoots up, delete it again and it goes down. Thanks for the correction, answer updated. – womble Nov 25 '09 at 16:17
0

What Womble said is correct in how cache is managed but that doesn't rule out a memory leak. So keep an eye on what processes seem to be creeping in it's memory usage. Once you identify the suspect processes you will have to determine if this is normal behaviour, in which case it may be tunable behaviour, or a memory leak.

Services like MySQL have a tunable amount of ram that they will use for caching. It could be that this is just set to high for your system making MySQL caching too aggressive. Lowering this may result in lower performance if this is the case you'll want to consider getting more ram in the server.

3dinfluence
  • 12,409
  • 2
  • 27
  • 41