Below is the way to calculate the "actual" memory utilization in the past using "sar" file. Below is the way to do the same.
Method 1:
tch memory utilization data from sar files using -r switch.
sar -r -f
It will display data in this format
04:40:01 PM kbmemfree kbmemused %memused kbbuffers kbcached kbswpfree kbswpused %swpused kbswpcad
04:50:01 PM 258788 16372260 98.44 12696 13912224 12484624 94144 0.75 420
Information being displayed here, is somewhat misleading. According to it, at 04:50PM, 98.44% memory was utilized (As its merely calculated by formula kbmemused/sum(kbmemused, kbmemfree)).
But in actual that was not the case. In order to get actual memory utilization, subtract kbbuffers and kbcached from kbmemused, and then used the above formula. In this case,
Memory utilization = (16372260-12696-13912224)/(258788+16372260) = 14.71%
The reason behind this is Linux treats unused memory as a wasted resource and so uses as much RAM as it can to cache process/kernel information.
Here Buffers= amount of physical memory used as buffers for disk writes
Cached = amount of physical memory used as cache for disk reads
Method 2:
I prefer this way
Method 2:
I prefer this way
free -m command
# free -m total used free shared buffers cached Mem: 12011 9825 2186 0 243 5829 -/+ buffers/cache: 3752 8259 Swap: 16378 313 16065
= ((243 + 5829) + 2186
= 8259 Free memory
No comments:
Post a Comment