Linux Command -- iostat, linuxiostat
Iostat -- I/O statistics (input/output statistics)
1. Role
List the I/O status of the entire CPU and interface device in real time.
2. Installation
Iostat is a sysstat package and can be directly installed using yum:
Yum install sysstat
3. Usage
Iostat [parameter] [interval seconds] [detection times]
Parameters: [-C |-d] [-k |-m] [-t] [-x]
-C: only the CPU status is displayed;
-D: Only displays the status of the storage device and cannot be used with-c;
-K: The block unit is displayed by default, which can be changed to KB;
-M: similar to-k, in MB;
-T: Display date;
-X: displays details.
4. Example
4.1 iostat
Avg-cpu: Overall cpu usage statistics. For multi-core CPUs, here is the average of all CPUs.
% User: Percentage of CPU time in user mode.
% Nice: Percentage of CPU time in user mode with NICE value.
% System: Percentage of CPU time in system mode.
% Iowait: Percentage of CPU waiting for input/output completion time.
% Steal: Percentage of unconscious waiting time of the virtual CPU when the hypervisor maintains another virtual processor.
% Idle: Percentage of idle CPU time.
Note: For cpu statistics, we mainly look at the iowait value, which indicates the time when the cpu is used to wait for the completion of io requests.
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 too high, it indicates that the CPU is idle;
If the % idle value 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.
Device: IO statistics of various disk devices
Tps: the average number of transfers per second (Indicate the number of transfers per second that were issued to the device), which is related to the number of data transfers, rather than the capacity. "One transmission" means "one I/O Request ". Multiple logical requests may be merged into one I/O Request ". The size of a "one-time transmission" request is unknown.
Blk_read/s: Average number of read sectors per second from the start to the present (one sector is 512 bytes );
Blk_wrtn/s: Average number of write sectors per second from startup to present;
Blk_read: Total number of sectors read from the boot to the present;
Blk_wrtn: Total number of sectors written since startup.
4.2 iostat-c
Only the CPU status is displayed:
4.3 iostat-d
Only display the status of the storage device:
4.4 iostat-k
The size of KB is displayed. The value here is half of the original value (1KB = 512bytes * 2) compared to the unit of Slice ):
4.5 iostat-m
In MB size:
4.6 iostat-t
Display time:
4.7 iostat 2 3
Detected every 2 seconds. detected three times in total:
Note: If the number of detection times exists, the data is displayed for the first time from the start to the present, and the data displayed after the second time represents the system transfer value between the two checks.
4.8 iostat-x
Show more details:
Attribute description:
Rrqm/s: the number of times the read requests to the device are merged per second. The file system merges the requests to read the same block;
Wrqm/s: Number of write requests to the device per second merged;
R/s: The number of reads completed per second;
W/s: the number of completed writes per second;
Rsec/s: number of sectors read per second;
Wsec/s: number of sectors written per second;
Avgrq-sz: Average number of request sectors;
Avgqu-sz: average length of the Request queue. The shorter the queue length, the better;
Await: Average IO request wait time (including wait time and processing time, in milliseconds ). It can be understood as the IO response time. Generally, the system IO response time should be less than 5 ms. If it is greater than 10 ms, it will be relatively large. Generally, await is larger than svctm. The smaller the difference, the shorter the wait time, the less I/O wait, and the better the disk performance. The larger the difference, the longer the wait time, applications running on the system are slow;
Svctm: average processing time of each IO request (in milliseconds );
% Util: The time ratio used for IO operations in the sampling period, that is, the non-empty time ratio of the IO queue. For example, if the statistical interval is 1 second, the device processes IO for 0.8 seconds, and the device is idle for 0.2 seconds, % util = 0.8/1 = 80%, therefore, this parameter implies the degree to which the device is busy. Generally, if this parameter is set to 100%, it indicates that the device is nearly running at full capacity (of course, if it is a multi-disk, even if % util is 100%, because of the concurrency of the disk, so the disk usage may not be a bottleneck ).