Kernel Cache on AMP

Aruba Employee
Aruba Employee

Question: Why does Linux always seem to have so little free memory. Does this indicate some kind of problem in Linux or in the application? 

Answer : No. 

The kernel attempts to keep available (free) memory slightly above zero by keeping the cache as large as possible. This is a feature of the operating system. 

Disk cache is maintained globally, not per-process. Files can remain in cache even after the process that was using them exited because they might be used by another process. Freeing the cache would mean discarding cached data. There's no reason to do that until the data is obsolete (e.g. files are deleted) or until the memory is needed for some other purpose. 

Linux keeps a little bit of memory free so that it is ready as soon as it needs to allocate more memory. If that remaining 60MB were also used for the cache then when a new allocation was required the kernel would have to go through the cache and work out what to evict. It might even need to wait for a page to be written out. This would make allocation slower and more complex. So the trade off is to make the page cache slightly slower so that allocation can be faster. The kernel keeps just a few free pages prepared in advance. 

So in AMP, irrespective of the amount of memory, the free memory will always be around 2 GB. If you’re looking at the System > Performance page you can see how much RAM is actively used by the AMP vs how much is cached by the OS. If you ever see that swap memory is being used, that may be cause for concern when RAM is fully utilized. Some swap usage is expected as long inactive memory pages are swapped to disk in order to free memory. In most deployments the amount of actively used RAM is usually around 2GB – 6GB. 

To determine RAM utilization the best metric to use is the -/+ buffers/cache output from the "free -m" command. This value represents the total used/available memory if you do not include kernel buffers and cache which will be purged if necessary. Another way to view this memory usage is the historical "AMP" memory usage from the AMP System->Performance page. If "AMP" memory usage is not approaching or exceeding total available memory then memory capacity is not an issue. 

Other related links:

Version history
Revision #:
1 of 1
Last update:
‎06-16-2014 10:23 AM
Updated by:
Labels (1)