Wednesday, September 4, 2013

Memory usage is very high on Redhat Linux



# cat free
             total       used       free     shared    buffers     cached
Mem:      24674784   24576836      97948          0     351244   21165268
-/+ buffers/cache:    3060324   21614460<<<<-----actual buffers="" cached="" free="" memory="" p="">
Swap:     25165808    1084452   24081356


    Total Physical Memory = 24674784 KB = 24096 MB

    Physically Used Memory = 24576836 KB = 24000 MB

    Actual used memory = 3060324 KB = 2988 MB = ~3 GB

    buffers = 351244 KB = 343 MB

    cached = 21165268 KB = 20669 MB = ~20 GB

    Physically Free Memory = 97948 KB = 95 MB

    Memory free for Applications = 21614460 KB = 21107 MB = ~20 GB


The items to note here are:

= + +

= - - -

= -

 
by Applications> = - -


The philosophy in Linux is that an unused resource is a wasted resource. The kernel therefore will use as much RAM as it can to cache information from your local and remote filesystems and disks. This builds up over time as reads and writes are done on the system trying to keep the data stored in RAM as relevant as possible to the processes that have been running on your system.

This caching is reported by the system as the sum of two numbers, buffers and pagecache. The cache is reclaimed, not at the time of process exit (you might start up another process soon that needs the same data), but upon demand - i.e. When you start a process that needs a lot of memory to run, the Linux kernel will reclaim memory that had been storing cached data and give it to the new process.

Refer below article for detail information on this:

What is cache memory and why is memory utilization high for cache memory?

Why is so much of my memory used by cache?