2, Monitoring memory details (sar -r)
The switch “-r” will help you to analyse memory usage by using sar command. The command usages are similar to previous. Different usages are listed below:
sar -r (Lists the details from the staring of this day)
With an interval
sar -r 1 2 (Lists memory usage details two times with an interval of on second)
From the file
sar -r -f /var/log/sa/sa23 (Fetch memory usage details of previous dates. Those files are located under “/var/log/sa/”).
Example
[root@vps ~]# sar -r 1 2
Linux 2.6.32-042stab088.4 (vps.crybit.com) 03/19/15 _x86_64_ (8 CPU)
16:45:59 kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit
16:46:00 109548 414740 79.11 0 300664 0 0.00
16:46:01 109544 414744 79.11 0 300664 0 0.00
Average: 109546 414742 79.11 0 300664 0 0.00 Field descriptions >> kbmemfree : Amount of free memory available in kilobytes. >> kbmemused : Amount of used memory in kilobytes. This does not take into account memory used by the kernel itself. >> %memused : Percentage of used memory. >> kbbuffers : Amount of memory used as buffers by the kernel in kilobytes. >> kbcached : Amount of memory used to cache data by the kernel in kilobytes. >> kbcommit : Amount of memory in kilobytes needed for current workload. This is an estimate of how much RAM/swap is needed to guarantee that there never is out of memory. >> %commit : Percentage of memory needed for current workload in relation to the total amount of memory (RAM+swap). This number may be greater than 100% because the kernel usually overcommits memory.