Linux SAR command:
SAR (System activity Reporter report) is one of the most comprehensive system performance analysis tools available on Linux, which can be used to report the activities of the systems in many ways, including: Read and write of files, usage of system calls, disk I/O, CPU efficiency, Memory usage, process activity, and IPC-related activities.
[Root ~]$ Sar-<interval > [< times >-A] [-b] [-b] [-c] [-d] [-h] [-m] [-p] [-Q] [ -R] [--S] [-t] [-u [All]] [-v] [-v] [-W ] [-W] [--I {<int> [,. ..] | SUM | All | Xall}] [-p {<cpu> [,...] | -j {ID | LABEL | PATH | UUID | ... } ] [-N {<keyword> [,...] | -o [<filename>] | -F [<filename>]] [---I <interval>] [-S [
Options is a command-line option, and the SAR command is commonly used as follows:
-A: Sum of all reports
-U: Output statistics about CPU usage
-V: Output statistics for inode, files, and other kernel tables
-D: Output activity information for each block device
-r: Output memory and swap space statistics
-B: Display statistics for I/O and transfer rates
-A: File read and write status
-C: Output process statistics, number of processes created per second
-r: Output memory page statistics
-Y: terminal equipment activity situation
-W: Output system Exchange activity information
1. CPU Resource monitoring For example, sampling every 10 seconds, sampling 3 times in a row, observing CPU usage:
Sar-u 10 3
[Root ~]$ sar-uTen 3Linux2.6. +-431.20.5. el6.x86_64 (Localhost.localdomain) December 09, 2014 _x86_64_ (1CPU) 17:12 09 second CPU%user% Nice%system%iowait%steal%Idle17 12 minutes, 19 seconds All0.00 0.00 0.20 0.00 0.00 99.8017:12 29 sec All0.00 0.00 0.10 0.00 0.00 99.9017:12 39 sec All0.00 0.00 0.10 0.00 0.00 99.90Average time: all0.00 0.00 0.13 0.00 0.00 99.87
1. If the%iowait value is too high, it indicates that the hard disk has an I/O bottleneck
2. If the value of the%idle is high but the system responds slowly, it is possible that the CPU waits for the allocated memory, at which time the memory capacity should be increased
3. If the value of%idle is consistently below 1, the system has a relatively low CPU capacity, indicating that the most necessary resource to be addressed in the system is the CPU.
2.I/Oand transmission rate monitoringFor example, sampling every 10 seconds, sampling 3 times in a row, reporting the use of the buffer, you need to type the following command:
Sar-b 10 3
[Root ~]$ Sar-bTen 3Linux2.6. +-431.20.5. el6.x86_64 (Localhost.localdomain) December 09, 2014 _x86_64_ (1CPU) 17:16 11 sec. tps Rtps Wtps Bread/s bwrtn/S17 16 minutes, 21 seconds .0.00 0.00 0.00 0.00 0.0017:16 31 sec0.00 0.00 0.00 0.00 0.0017:16 41 sec1.80 0.00 1.80 0.00 15.23Average Time:0.60 0.00 0.60 0.00 5.08
TPS: Total I/O transfers per second for physical devices
Rtps: Total amount of data read from physical devices per second
Wtps: The total amount of data written to the physical device per second
BREAD/S: The amount of data read from the physical device per second, in blocks/s
BWRTN/S: The amount of data written to the physical device per second, in blocks/s
3. Process Queue Length and average load status monitoringFor example, sampling every 10 seconds, sampling 3 times in a row, monitoring process queue length and average load status:
Sar-q 10 3
[Root ~]$ sar-qTen 3Linux2.6. +-431.20.5. el6.x86_64 (Localhost.localdomain) December 09, 2014 _x86_64_ (1CPU) 17:20 14 sec runq-sz Plist-sz ldavg-1ldavg-5ldavg- the17:20 24 sec0 173 0.00 0.00 0.0017:20 34 sec0 173 0.00 0.00 0.0017:20 44 sec0 173 0.00 0.00 0.00Average Time:0 173 0.00 0.00 0.00
Output Item Description:
Runq-sz: Length of the run queue (number of processes waiting to run)
Plist-sz: Number of processes (processes) and threads (threads) in the process list
Ldavg-1: Average system load for last 1 minutes (systems load average)
Ldavg-5: System average load over the last 5 minutes
Ldavg-15: System average load over the last 15 minutes
Not to be continued
Common system performance analysis tools