Vmstat,iostat,sar command Explanation

Source: Internet
Author: User
Tags disk usage

procsR: Number of processes waiting to run B: number of processes in non-disruptive sleep state w: number of running processes that have been swapped out. This number is calculated by Linux, but Linux does not run out of swap space MemorySWPD: Virtual memory usage, in KB free: idle memory, Unit KB buff: Number of memory used as cache, in KB SwapSi: Number of swap pages from disk swap to memory, in kb/seconds so: number of swap pages from memory swap to disk, in kb/seconds IOBI: Number of blocks sent to block device, Unit: block/sec bo: Number of blocks received from block device, units: Blocks/sec SystemIn: Interrupts per second, including clock interrupt CS: Environment (context) switch times per second CPUDisplays the US:CPU usage time as a percentage of the total CPU usage sy:cpu system usage time ID: idle time quasi-test r<5,b≈0,
If the fre<minfree, there will be a continuous page scheduling, will cause system performance problems.
For the page column, the Re,pi,po,cy is maintained in a relatively stable state, the PI rate is not more than 5, if there is a pagin occurrence, then the associated page must be pageout in a relatively tight memory environment Pagein will force a different page steal operation. If the system is reading a large number of permanent pages, you may see an inconsistent growth in the PO and PI columns, which does not necessarily indicate that the system is overloaded, but it is necessary to check the data access patterns of the application. In a stable situation, the scanning rate and the replacement rate are almost equal, in the case of multiple processes using different pages, the page will be more unstable and messy, the scanning rate may be higher than the percentage of the rate.  </minfree, there will be continuous page scheduling, which will result in system performance problems. Faults column, In,sy,cs will continue to jump, there is no definite limit, the only thing is that these values are at least greater than the CPU column, Us,sys,id and WA is also uncertain, the ideal state is to make the CPU in 100% working state, this is only suitable for single-user case.
If you Us+sys "80 in a multiuser environment, the process will spend a waiting time in the run queue, and the response time and throughput will drop. WA&GT;40 indicates that disk IO may not have an unreasonable balance, or that disk operations are more frequent, Vmstat:
If R is often greater than 4 and the ID is often less than 40, it indicates that the CPU is heavily loaded.
If the Pi,po is not equal to 0 for a long time, it indicates insufficient memory.
If disk is often not equal to 0, and the queue in B is greater than 3, the IO performance is poor. With high stability and reliability, Linux is scalable and scalable, adapting to different application and hardware environments to optimize performance for the needs of current applications. Therefore, it is important for enterprises to understand the system performance analysis tools when they are maintaining the Linux system and tuning the systems.
There are many system performance analysis tools under Linux, more common are top, free, PS, time, Timex, uptime and so on. Several of the more important performance analysis tools Vmstat, Iostat, and SAR and their use are described below.

  Monitor memory usage with Vmstat

Vmstat is an abbreviation for virtual meomory Statistics (dummy memory statistics) that monitors the operating system's virtual memory, processes, and CPU activity. It is the overall situation of the system statistics, the disadvantage is that a process can not be in-depth analysis.

The syntax for Vmstat is as follows:

Vmstat [-v] [-n] [delay [count]]
Where-V means that the version information is printed out, and-n means that the output header information is displayed only once for cyclic output, and that the delay is the time between two outputs, and count refers to the number of times that are counted at this interval. For vmstat output The meaning of each field, you can run the man Vmstat view.

  using Iostat to monitor I/O subsystem conditions

The IOSTAT is an abbreviation for I/O statistics (input/output statistics), and the Iostat tool monitors the system's disk operation activity. It is characterized by the reporting of disk activity statistics, as well as the reporting of CPU usage. Like Vmstat, Iostat also has a weakness, that is, it cannot analyze a process in depth, only the overall situation of the system.

The syntax for Iostat is as follows:

Iostat [-C |-d] [-K] [-t] [-v] [-X [Device]] [interval [count]]
Among them,-C to report CPU usage;-D to report disk usage,-K to display data per second in kilobytes bytes,-t for print reporting, and-V to print out version information and usage, and-X device to specify the unit name to be counted Interval refers to the time interval of each statistic, and count refers to the number of times that are counted at this interval.

Iostat General output format is as follows:

Linux 2.4.18-18smp (build er.linux.com)   March 07, 2003  avg-cpu: %user  %nice   %sys  % idle           4.81    0.01    1.03   94.15 device:            tps    blk_read/s   blk_wrtn/s   blk_read   blk_wrtndev3-0            30.31      1117.68        846.52   16104536   12197374dev3-1             7.06       229.61        40.40    3308486     582080

For the meanings of the fields in the output, the Iostat help is explained in detail.

  using SAR for comprehensive analysis

Table 1 Description of SAR parameters

Options feature

-A summarizes all reports

-A report file read and write usage

-B reports on the use of additional caches

-B Reporting Cache usage

-C reporting usage of system calls

-D Report Disk usage

-G Report the use of the serial port

-H Report statistics on the use of buffer

-M reports the use of IPC Message Queuing and semaphores

-N reporting usage of named caches

-P Report Paging activity usage

-Q reports the average length of the run queue and the interchange queue

-R reporting Process activity

-R Report unused memory pages and hard disk blocks

-U Reports CPU Utilization

-V reporting process, I node, file, and lock table status

-W Reporting System Exchange activity status

-Y reports TTY device activity status

The SAR is an abbreviation for the system activity Reporter (Systems Activities report). As the name implies, the SAR tool samples the current state of the system and then expresses the current state of the system by calculating the data and scale. It is characterized by a continuous sampling of the system, the acquisition of a large number of sampling data, sampling data and analysis of the results can be stored in the file, the required load is very small. The SAR is one of the most comprehensive system performance analysis tools on Linux, which can be used to report the activities of the systems from 14 aspects, including the reading and writing of the files, the usage of the system calls, the serial port, CPU efficiency, memory usage, process activities and IPC related activities.

The syntax of the SAR is as follows:

SAR [-option] [-o file] t [n]

It means sampling every T-second and sampling n times. Where-o file indicates that the sample results will be stored in binary form in the file.

Another syntax is as follows:

SAR [-option] [-s time] [-e time] [-I sec] [-f file]
The meaning is to take the data out of the file and, if no-f file is specified,/var/adm/sa/sadd the data from the standard data file, where DD represents the current day. In addition,-s time represents the start date, and-e times indicates the stop time, and the-I sec represents the time interval for sampling, and if not specified, all data in the file is taken. See table 1 for specific options.

It is typically used in conjunction with-Q and-U to analyze the usage of each CPU, such as running the following command:

Sar-q-U 5 1
The output will be as follows:
Linux 2.4.18-18SMP (builder.linux.com)        March 07, 2003  09 46 points 16?      CPU    %user    %nice  %system     %idle09 46 minutes 21?      all      0.20       0.00      0.00     99.80 09 46 min 16?  runq-sz  plist-sz   ldavg-1   ldavg-509 46 min 21?        0        91      0.00      0.00 average:          cpu    %user     %nice  %system    %idleaverage:           all      0.20      0.00      0.00     99.80 average:      Runq-sz   plist-sz   ldavg-1   ldavg-5average:             0        91      0.00       0.00

Because the SAR command is too complex to understand the meaning of each option only by using proficiency, it can be explained in detail to run the man SAR command for the meaning of each field in the SAR output.

Vmstat,iostat,sar command Explanation

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.