Monday, 15 October 2018

How to analyze memory usage using SAR command



Sar command with option “-r” to generate memory usage report. %kbmemfree, %kbbuffers and %kbcached are the overall memory used including RAM & Swap. Its shows values at every interval or required time interval.
Run the following command to lists memory usage details with three times interval with a second:

[root@linuxcnf ~]# sar -r 1 2
Linux 2.6.32-754.3.5.el6.x86_64 (GGN01-QONBOARD)        10/15/2018      _x86_64_        (1 CPU)

08:39:15 PM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit
08:39:16 PM    390368   1532660     79.70    146868    558356   1194320     29.71
08:39:17 PM    390376   1532652     79.70    146868    558356   1194320     29.71
Average:       390372   1532656     79.70    146868    558356   1194320     29.71
[root@linuxcnf ~]#


Run the following command to fetch historical memory usage details from the logs located under /var/log/sa/:

[root@linuxcnf ~]# sar -r -f /var/log/sa/sa28
Linux 2.6.32-754.3.5.el6.x86_64 (GGN01-QONBOARD)        09/28/2018      _x86_64_        (1 CPU)

12:00:01 AM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit
12:10:01 AM    434856   1488172     77.39    149152    487132   1264604     31.46
12:20:01 AM    420784   1502244     78.12    149304    487224   1264604     31.46
12:30:01 AM    416564   1506464     78.34    149452    487300   1273628     31.68
12:40:01 AM    400072   1522956     79.20    156868    494424   1264848     31.46
12:50:01 AM    398312   1524716     79.29    157660    494496   1266600     31.51
01:00:01 AM    396528   1526500     79.38    157820    494548   1269552     31.58
01:10:01 AM    396812   1526216     79.37    157996    494664   1269552     31.58
..........
[root@linuxcnf ~]#

It’s done!!!

No comments:

Post a Comment