View disk IO in Linux and find out the processes that occupy high IO read and write

View disk IO in Linux and find out the processes that occupy high IO read and write

Background - Online Alert

An online server issued an alarm, and the disk utilization disk.util > 90, and the alarm continued.

After logging in to the server, I used iostat -x 1 10 to view the relevant disk usage information. The relevant screenshots are as follows:

 # If there is no iostat command, use yum install sysstat to install it # iostat -x 1 10 

As can be seen from the above figure, the %util[IO] of the vdb disk is almost 100% due to frequent data reading.

Other Field Descriptions

Device: device name
TPS: The number of IO read and write requests per second. Multiple logical requests can be combined into a single I/O request to the device.
Blk_read/s (kB_read/s, MB_read/s): The amount of data read from the device, expressed in blocks (kilobytes, megabytes) per second. A block is equivalent to a sector, so the block size is 512 bytes.
Blk_wrtn/s (kB_wrtn/s, MB_wrtn/s): The amount of data written to the device, expressed in blocks (kilobytes, megabytes) per second. A block is equivalent to a sector, so the block size is 512 bytes.
Blk_read (kB_read, MB_read): Total number of blocks read (kilobytes, megabytes).
Blk_wrtn (kB_wrtn, MB_wrtn): Total number of written blocks (kilobytes, megabytes).

rrqm/s: The number of read requests merged to the device per second. That is, delta(rmerge)/s
wrqm/s: The number of write requests merged to the device per second. That is, delta(wmerge)/s
r/s: The number of read I/O device reads completed per second. That is delta(rio)/s
w/s: The number of write I/0 devices completed per second. That is, delta(wio)/s
rsec/s (rkB/s, rMB/s): The number of sectors read from the device per second (kilobytes, megabytes). Each sector size is 512 bytes
wsec/s (wkB/s, wMB/s): The number of sectors written to the device per second (kilobytes, megabytes). Each sector size is 512 bytes

avgrq-sz: The average amount of data per device I/O operation (in sectors). That is, delta(rsec+wsec)/delta(rio+wio)
avgqu-sz: average length of the I/O queue sent to the device each time.
await: The average waiting time for each IO request. (including waiting queue time and processing time, in milliseconds)
r_await: average waiting time for each IO read request. (including waiting queue time and processing time, in milliseconds)
w_await: average waiting time for each IO write request. (including waiting queue time and processing time, in milliseconds)
svctm: Average processing time (in milliseconds) for each device I/O operation. warn! Do not trust the value of this field any more; this field will be removed in a future version of sysstat.
%util: What percentage of a second is used for I/O operations, or how much time in a second the I/O queue is non-empty. When this value approaches 100%, device saturation occurs.

Find the process with high IO usage

Through the iotop command

If the command is not available, install it using the yum install iotop command.

# iotop -oP

This command allows you to see more detailed information, such as process number, disk read volume, disk write volume, IO percentage, and the commands involved. "Both grep commands cause large IO read volumes."

Through the pidstat command

# Command meaning: Display I/O statistics, updated once a second # pidstat -d 1 

It can be seen that the grep command occupies a large amount of read IO. Then you can view the relevant process information based on the PID.

Note: The PID in this figure is different from that in the previous figure because the process in the previous figure has been executed, and this figure is the process generated after the execution [both execute the same script].

Summarize

The above is what I introduced to you about how to check disk IO in Linux and find out the processes that occupy a lot of IO read and write. I hope it will be helpful to you!

You may also be interested in:
  • Linux IO multiplexing epoll network programming
  • Detailed explanation of Linux command iostat
  • The difference between level triggering and edge triggering of Linux IO
  • Interesting explanation of Linux's Socket IO model
  • Discussion on details of IO, conditional and loop processing in Linux shell programming
  • How to use iostat to view Linux hard disk IO performance
  • A detailed introduction to Linux IO

<<:  JavaScript to implement the web version of Gobang game

>>:  Detailed explanation of MySQL 30 military rules

Recommend

How to prevent users from copying web page content using pure CSS

Preface When I was typing my own personal blog, I...

Two ways to configure Vue global methods

Table of contents 1. Introduction 2. The first me...

Refs and Ref Details in Vue3

The editor also shares with you the corresponding...

Analysis of the Principle of MySQL Index Length Limit

This article mainly introduces the analysis of th...

Vue implements zip file download

This article example shares the specific code of ...

Detailed explanation of system input and output management in Linux

Management of input and output in the system 1. U...

Detailed steps to install nginx on Apple M1 chip and deploy vue project

brew install nginx Apple Mac uses brew to install...

Solution to the problem of MySQL thread in Opening tables

Problem Description Recently, there was a MySQL5....

What are the differences between xHTML and HTML tags?

All tags must be lowercase In XHTML, all tags must...

Solution to the bug that IE6 select cannot be covered by div

Use div to create a mask or simulate a pop-up wind...

How to install Docker using scripts under Linux Centos

What is the main function of Docker? At present, ...

mysql 5.7.5 m15 winx64.zip installation tutorial

How to install and configure mysql-5.7.5-m15-winx...

How to solve jQuery conflict problem

In front-end development, $ is a function in jQue...

How to upgrade https under Nginx

Purchase Certificate You can purchase it from Ali...