Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use iostat command in Linux system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use iostat command in Linux system, Xiaobian thinks it is good, now share it with everyone, also give you a reference, follow Xiaobian to see it together!

Linux is a free-to-use and freely distributed UNIX-like operating system, is a POSIX-based multi-user, multitasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.

command explained in detail

Iostat in Linux is short for I/O statistics, and iostat tools monitor disk activity on the system. It features disk activity statistics as well as CPU usage. Like vmstat, iostat has a weakness in that it doesn't do in-depth analysis of a process, but only of the overall system.

iostat common command format is as follows:

iostat [Parameter] [Time] [Number]

Command parameters are described as follows:

-c shows CPU usage

-d Displays disk usage

-k is displayed in K units

-m is displayed in M units

-N Displays disk array (LVM) information

-n Shows NFS usage

-p reports the usage of each partition on each disk

- tDisplay terminal and CPU information

-x Show details

The following is a detailed summary of our common usage methods.

uses examples

Command: iostat -x

Description: Refresh display every 2 seconds and display 3 times

Output:

[user1@Test_Server ~]$ iostat -xLinux 3.10.0-693.2.2.el7.x86_64 (jellythink) 01/05/2019 _x86_64_ (1 CPU)avg-cpu: %user %nice %system %iowait %steal %idle 1.83 0.00 0.31 0.09 0.00 97.77Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %utilvda 0.03 0.78 0.24 1.38 12.64 20.67 41.01 0.02 10.98 55.50 3.17 0.71 0.12

Detailed explanation of output content:

%user: Percentage of time CPU is in user mode

%nice: Percentage of time CPU is in user mode with NICE value

%system: Percentage of time CPU is in system mode

%iowait: Percentage of time CPU waits for input/output to complete

%steal: Percentage of unconscious wait time of virtual CPU while hypervisor maintains another virtual processor

%idle: Percentage of CPU idle time

Of course, the iostat command isn't meant to look at CPU, it's meant to monitor disk performance.

Device: Device name

rrqm/s: Number of read requests merged to the device per second

wrqm/s: Number of write requests merged to the device per second

r/s: Number of read operations initiated to disk per second

w/s: Number of writes to disk per second

rkB/s: K bytes read per second

wkB/s: K bytes written per second

avgrq-sz: Average data size per device I/O operation

avgqu-sz: Average I/O queue length

await: Average latency (ms) per device I/O operation. Generally, the system I/O response time should be less than 5ms, and if it is greater than 10ms, it is relatively large.

r_await: Average time taken per read operation; includes not only the time taken to read the hard disk device, but also the time spent waiting in the kernel queue

w_await: Average time taken per write operation; includes not only the time taken to write to the hard disk device, but also the time spent waiting in the kernel queue

svctm: Average service time per device I/O operation (milliseconds)(This data is unreliable!)

%util: What percentage of a second is spent on I/O operations, i.e., the percentage of CPU consumed by IO. Generally, if this parameter is 100%, it means that the device is running close to full capacity.

Command: iostat -d 2 3

Output:

[jelly@jellythink ~]$ iostat -d 2 3Linux 3.10.0-693.2.2.el7.x86_64 (jellythink) 01/05/2019 _x86_64_ (1 CPU)Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtnvda 1.62 12.64 20.67 337375593 551756524Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtnvda 1.00 0.00 8.00 0 16Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtnvda 0.00 0.00 0.00 0 0

Detailed explanation of output content:

tps: Number of I/Os per second (IOPS). Continuous disk reads and continuous disk writes

kB_read/s: Size of data read from disk per second in KB/s

kB_wrtn/s: Size of data written to disk per second, in KB/s

kB_read: The total number of data read from disk in KB

kB_wrtn: The total number of data written to disk in KB

Performance monitoring indicators

Having said so much and seen so many system outputs, what fields do we need to pay attention to in daily operation and maintenance? Here's the main point of this article, which outputs we should focus on to determine if there are IO performance bottlenecks on this server.

%iowait: A high value indicates an I/O bottleneck to the disk

Await: Generally, the system I/O response time should be less than 5ms, and if it is greater than 10ms, it is relatively large.

avgqu-sz: This value increases if the I/O request pressure continues to exceed disk capacity. If the queue length for a single disk continues to exceed 2, it is generally assumed that the disk has I/O performance issues. Note that if the disk is a virtual logical drive of a disk array, divide this value by the actual number of physical disks that make up the logical drive to get the average I/O wait queue length for a single hard disk

%util: In general, if this parameter is 100%, it means that the equipment is running close to full capacity.

Finally, in addition to focusing on metrics, we need to analyze in conjunction with the deployed business. For disk random read and write frequent business, such as image access, database, mail server, etc., such business, tps is the key point. For services with frequent sequential reads and writes, which need to transmit large blocks of data, such as video-on-demand and file synchronization, the throughput of the disk is concerned.

The above is how to use the iostat command collected by Xiaobian for everyone in Linux system, how to feel that the content of the website is not bad, welcome to recommend the website to friends around you.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report