Memory Utilization

How do I view system memory utilization in Centos

Issue

How do I view system memory utilization in Red Hat Enterprise Linux?

Resolution

The free command shows system memory utilization.For example:

rex@bunturx:~$ free total used free shared buffers cached Mem: 506940 220476 286464 0 12920 137240 -/+ buffers/cache: 70316 436624 Swap: 782332 0 782332

Each column means following:

    • The relation of the value above such as below:

    • ** Physically Used Memory = Actual used memory + buffers + cache

    • ** Physically Free Memory = Total Physical Memory - Actual used memory - buffers - cache

    • ** Memory free for Applications = Total Physical Memory - Actual used memory

    • ** Memory used by Applications = Physically Used Memory - buffers - cache

    • The output of top command has same value with free. In the following example, the "free" size in the line of "Mem" has already contained the "buffers" and "cached".

top - 17:40:56 up 9:09, 3 users, load average: 0.05, 0.15, 0.17 Tasks: 218 total, 2 running, 215 sleeping, 0 stopped, 1 zombie Cpu(s): 2.0%us, 0.0%sy, 0.0%ni, 98.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 2970624k total, 1919160k used, 1051464k free, 247024k buffers Swap: 2048276k total, 0k used, 2048276k free, 880556k cached

    • Since free by default only displays memory utilization information once, it is only useful for very short-term monitoring, or quickly determining if a memory-related problem is currently in progress.Although free has the ability to repetitively display memory utilization figures via its -s option, the output scrolls, making it diffcult to easily detect changes in memory utilization. The most sophisticated way to monitor your system is with the Sysstat tool.

    • Repetitively display example,free:

rex@bunturx:~$ free -s 1 -c 3 total used free shared buffers cached Mem: 506940 220912 286028 0 13108 137344 -/+ buffers/cache: 70460 436480 Swap: 782332 0 782332 total used free shared buffers cached Mem: 506940 220916 286024 0 13108 137344 -/+ buffers/cache: 70464 436476 Swap: 782332 0 782332 total used free shared buffers cached Mem: 506940 220916 286024 0 13108 137344 -/+ buffers/cache: 70464 436476 Swap: 782332 0 782332

    • Repetitively display example,sysstat tool:

rex@bunturx:~$ sar -r 1 3 Linux bunturx 3.13.0-32-generic #57~precise1-Ubuntu SMP Tue Jul 15 03:50:54 UTC 2014 i686 12/18/2015 08:47:56 memtot memfree buffers cached slabmem swptot swpfree _mem_ 08:47:57 495M 279M 12M 134M 15M 763M 763M 08:47:58 495M 279M 12M 134M 15M 763M 763M 08:47:59 495M 279M 12M 134M 15M 763M 763M

    • See also: FREE(1) (`man free`) || SAR(1) (`man sar`) || /proc/meminfo (`man 5 proc`)

Root Cause

    • Both free command and top command read information from /proc/meminfo.

eof