Basic Linux commands: sar and basic linux sar

Source: Internet
Author: User

Basic Linux commands: sar and basic linux sar
Common sar command formats

Sar [options] [-A] [-o file] t [n]

Where:

T indicates the sampling interval, and n indicates the number of samples. The default value is 1;

-O file: stores the command results in binary format. file is the file name.

Options is the command line option. Common options for sar commands are as follows:

 

-A: total of all reports

-U: outputs CPU usage statistics

-V: outputs statistics of inode, files, and other kernel tables.

-D: outputs the activity information of each block device.

-R: Output memory and swap space statistics

-B: displays the I/O and transfer rate statistics.

-A: file read/write status

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

-R: Output Memory Page statistics

-Y: terminal device activity

-W: Output System exchange activity information

 

Think twice:

Sar-u view CPU usage

Hejianping @ kk-mc-187 :~ $ Sar-u

 

Here: % user: Percentage of CPU time consumed in user mode; % nice: Percentage of CPU time consumed in user mode when process scheduling priority is changed through nice; % system: Percentage of CPU time consumed in system mode; % iowait: Percentage of idle time consumed due to CPU wait for disk I/O; % steal: when operating system virtualization technology such as Xen is used, wait for the time used by other virtual CPU computing; % idle: the CPU does not have the time consumed by idle state such as disk I/O; note: if the value of % iowait is too high, it indicates that the hard disk has an I/O bottleneck. If the value of % idle is high but the system response is slow, it may be that the CPU is waiting for memory allocation, in this case, the memory capacity should be increased. If the value of % idle is lower than 10, the CPU processing capability of the system is relatively low, indicating that the most important resource to be solved in the system is the CPU. Sar-q view average load

Hejianping @ kk-mc-187 :~ $ Sar-q

Runq-sz: length of the running Queue (number of processes awaiting running) plist-sz: Number of processes (processes) and threads (threads) in the Process List ldavg-1: system load average ldavg-5: average System load ldavg-15 for the past 5 minutes: average system load for the past 15 minutes sar-r view memory usage hejianping @ kk-mc-187 :~ $ Sar-r kbmemfree: idle physical memory; kbmemused: physical memory in use; % memused: physical memory usage; kbbuffers: physical memory used as a buffer in the kernel; kbcacheed: The physical memory capacity used as the cache in the kernel; kbswpfree: the free capacity of the swap area; kbswpused: The swap area capacity in use; sar-W view the page switching status hejianping @ kk-mc-187 :~ $ Sar-W sar-B view I/O and transfer rate statistics hejianping @ kk-mc-187 :~ $ Sar-B 1 5

 

Tps: Total Amount of I/O transmitted by physical devices per second rtps: Total amount of data read from physical devices per second wtps: Total amount of data written to physical devices per second bread/s: the volume of data read from the physical device per second. Unit: block/s bwrtn/s: the volume of data written to the physical device per second. Unit: block/s. Others: number of processes created by sar-c per second sar-n DEV outputs statistics on the status of network devices. Note: by default, data statistics are performed for the past time period, generally starting from. If you want to continue viewing the report one day ago, you can use the-f option to specify the log files saved in the/var/log/sa directory. If you want to periodically view the current data, you can add a number parameter after the command, such as sar-q 1 3, which means: 1 second, 3 times in total. To determine the system bottleneck, you sometimes need to combine several sar command options.

Suspected CPU bottlenecks, which can be viewed by sar-u and sar-q.

Suspected memory bottlenecks, which can be viewed by sar-B, sar-r, and sar-W.

I/O bottlenecks are suspected, which can be viewed by sar-B, sar-u, and sar-d.

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.