The Linux command SAR

Source: Internet
Author: User

SAR(System activity Reporter report) is one of the most comprehensive system performance analysis tools for Linux systems, and can be used in many ways to understand the health of your systems, including CPU efficiency, file system read and write, disk I/O, memory usage, Process activities and so on.

Command format: SAR [options] [-A] [-o file] t [n]

-A: Sum of all reports

-O: Saves the result in binary form to the file

T: time interval for sampling

N: Number of samples, default = 1

The common options for option are as follows:

-U: Output statistics about the CPU

-D: Output statistics for each block device

-Q: Output queue Length and average load statistics

-R: Statistics for output memory and swap partitions

-B: Output I/O and transfer rate statistics

-A: Displays the read and write status of the file

-C: Output process statistics, number of processes created per second

-r: Output memory page statistics

-Y: Activity of Device terminal

-W: Output system Exchange activity information

-V: Output statistics for inode, files, and other kernel tables

Example:

To view the process queue length and average load:

[Email protected] ~]# SAR-Q 5 3

Linux 2.6.32-642.el6.i686 (email.benet.com) 04/02/2017 _i686_(1 CPU)


11:35:34 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15

11:35:39 AM 0 184 1.45 0.78 0.61

11:35:44 AM 0 184 1.33 0.77 0.61

11:35:49 AM 0 184 1.31 0.77 0.61

average:0 184 1.36 0.77 0.61

Runq-sz: Run Queue Length (number of processes waiting to run)

Plist-sz: Number of processes and threads in the process list

The last three segments represent the average load for the nearest 1 minutes, 5 minutes, and 15 minutes


View Device usage

sar-d 5 3-p #每5秒采样一次, continuous sampling 3 times

Linux 2.6.32-642.el6.x86_64 (localhost.localdomain) 01/23/2017 _x86_64_(2 CPU)

12:21:07 PM DEV TPs rd_sec/s wr_sec/s avgrq-sz avgqu-sz await SVCTM%util

12:21:12 PM SDA 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

12:21:12 PM DEV TPs rd_sec/s wr_sec/s avgrq-sz avgqu-sz await SVCTM%util

12:21:17 PM SDA 1.20 0.00 12.80 10.67 0.00 0.50 0.17 0.02

12:21:17 PM DEV TPs rd_sec/s wr_sec/s avgrq-sz avgqu-sz await SVCTM%util

12:21:22 PM SDA 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

Average:dev TPs rd_sec/s wr_sec/s avgrq-sz avgqu-sz await SVCTM%util

AVERAGE:SDA 0.40 0.00 4.27 10.67 0.00 0.50 0.17 0.01

TPS: Number of times per second from physical disk I/O. Multiple logical requests are merged into one I/O disk request, and the size of one transfer is indeterminate.

RD_SEC/S: Number of Read sectors per second.

WR_SEC/S: Number of Write sectors per second.

Avgrq-sz: The average data size (sector) per device I/O operation.

Avgqu-sz: The average length of the disk request queue.

Await: The average elapsed time of each request, including the request queue wait time, in milliseconds (1 seconds =1000 milliseconds), from the request disk operation to the completion of the system processing.

SVCTM: The average time that the system processes each request, excluding the time consumed in the request queue.

%UTIL:I/O requests account for the percentage of the CPU, the higher the ratio, the more saturated the description.

1) When the value of Avgqu-sz is low, the equipment utilization is higher.

2) When the value of%util is close to 1%, it indicates that the device bandwidth is already full.


View memory and swap space

[Email protected] ~]# Sar-r 2 3

Linux 2.6.32-642.el6.i686 (email.benet.com) 04/02/2017 _i686_(1 CPU)


11:51:49 AM kbmemfree kbmemused%memused kbbuffers kbcached kbcommit%commit

11:51:51 AM 16124 494472 96.84 82688 172652 506100 32.98

11:51:53 AM 16124 494472 96.84 82688 172652 506100 32.98

11:51:55 AM 16008 494588 96.86 82692 172656 506100 32.98

average:16085 494511 96.85 82689 172653 506100 32.98

Kbmemfree: This value is basically the same as the free value in the command, so it does not include buffer and cache space.

Kbmemused: This value is basically the same as the used value in the free command, so it includes buffer and cache space.

%memused: This value is a percentage of kbmemused and total memory (excluding swap).

Kbbuffers and kbcached: These two values are the buffer and cache in the free command.

Kbcommit: Ensure that the current system requires memory (RAM+SWAP) in order to ensure that it does not overflow.

%commit: This value is a percentage of kbcommit and total memory (including swap).


viewing I/O and transfer rates

[Email protected] ~]# Sar-b 2 3

Linux 2.6.32-642.el6.i686 (email.benet.com) 04/02/2017 _i686_(1 CPU)


11:54:26 AM TPs Rtps Wtps bread/s bwrtn/s

11:54:28 AM 4.04 0.00 4.04 0.00 60.61

11:54:30 AM 4.55 0.00 4.55 0.00 40.40

11:54:32 AM 0.00 0.00 0.00 0.00 0.00

average:2.86 0.00 2.86 0.00 33.61

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


Summarize:

View CPU performance information, which can be viewed through sar-u or sar-q

View memory information, available through Sar-r

viewing I/O information: Available through sar-b or sar-d








This article from "10,000 years too long, seize" blog, please be sure to keep this source http://zengwj1949.blog.51cto.com/10747365/1912551

The Linux command SAR

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.