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

What is the monitoring tool Linux iotop

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

In this issue, the editor will bring you about what is the monitoring tool Linux iotop. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Brief introduction of iotop:

Iotop is an open source, free tool similar to the top command for monitoring disk Imax O usage, and iotop can monitor the Imax O information of the process. It is written in the Python language. Compared with the iostat tool, iostat is system-level IO monitoring, while iotop is process-level IO monitoring. The latest version is iotop 0.6. Its official website is http://guichaz.free.fr/iotop/[1]

Installation of iotop:

Note that there are prerequisites for iotop installation (if the operating system does not meet these conditions, iotop cannot be installed correctly):

1: kernel version 2.6.20 or later

2:Python 2.7 or later

The details of the official documents are as follows:

Linux has always been able to show how much O was going on (the bi and bo columns of the vmstat 1 command).

Iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on. It requires Python ≥ 2.7 and a Linux kernel ≥ 2.6.20 with the TASK_DELAY_ACCT CONFIG_TASKSTATS, TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options on.

Yum installation of iotop

Yum installation is the easiest and quickest. The prerequisite is that you have a source configuration that configures yum.

[root@DB-Server ~] # python-V Python 2.7.5 [root@DB-Server ~] # uname-a Linux DB-Server 3.10.0-862.el7.x86_64 # 1 SMP Fri Apr 20 16:44:24 UTC 2018 x86 "64 GNU/Linux [root@DB-Server] # [root@DB-Server ~] # yum-y install iotop

Source code installation of iotop

Wget http://guichaz.free.fr/iotop/files/iotop-0.6.tar.bz2 tar-xvf iotop-0.6.tar.gz cd iotop-0.6 python setup.py build python setup.py install

Parameters of iotop

# iotop-- help Usage: / usr/local/sbin/iotop [OPTIONS] DISK READ and DISK WRITE are the block I bandwidth used during the sampling period. SWAPIN and IO are the percentages of time the thread spent respectively while swapping in and waiting on I/O more generally. PRIO is the O priority at which the thread is running (set using the ionice command). Controls: left and right arrows to change the sorting column, r to invert the sorting order, o to toggle the-- only option, p to toggle the-- processes option, a to toggle the-- accumulated option, i to change I q to quit O priority, q to quit, any other key to force a refresh. Options:-- version show program's version number and exit-h,-- help show this help message and exit-o,-- only only show processes or threads actually doing I NUM O-b,-- batch non-interactive mode-n NUM,-- iter=NUM number of iterations before ending [infinite]-d SEC,-- delay=SEC delay between iterations [1 second]-p PID -- pid=PID processes/threads to monitor [all]-u USER,-- user=USER users to monitor [all]-P,-- processes only show processes, not all threads-a,-accumulated show accumulated I Compact O instead of bandwidth-k,-- kilobytes use kilobytes instead of a human friendly unit-t,-- time add a timestamp on each line (implies-- batch)-Q -- quiet suppress some lines of header (implies-- batch)

Keyboard shortcuts for iotop

R: reverse sort

O: switch to option-- only

P: switch to-- processes option

A: switch to the-- accumulated option

Q: exit

I: change the priority of the thread

The example of iotop

1: show only the processes that are generating Igamo

# iotop-o

2: use non-interactive mode to write iotop command output information to the log

# nohup iotop-b-o-n 10-d 5-t > / tmp/iotop.log &

3: with the help of the iotop command, find the process that consumes the highest amount of SQL O, and then use the process to find the SQL statement that it is executing.

# iotop-oP PID PRIO USER DISK READ DISK WRITE SWAPIN IO > COMMAND 11741 be/4 oracle 4.70 M be/4 oracle s 0.00 Bhand s 0.00% 98.60% ora_s004_SCM2 11739 be/4 oracle 66 .99 M ora_s006_SCM2 s 0.00 M Universe 0.00% 93.30% ora_s005_SCM2 11741 be/4 oracle 21.76 M Accord 0.00 M Accord 0.00% 91.78% ora_s006_SCM2 11743 be/4 oracle 4.87 M Universe 0.00% 27.74% ora_s007_SCM2 11745 be/4 oracle 62.39 Khand 0.00% 2.88% Ora_s008_SCM2 11733 be/4 oracle 39.00K Universe 0.00% 2.08% ora_s002_SCM2 11697 be/4 oracle 0.00BUnip 0.00% 0.30% ora_dbw0_SCM2 11699 be/4 oracle 0.00BUnix 0.00% 0.20% ora_lgwr_SCM2

After finding the process that consumes the most SQL O, find out the SQL statement that the ORACLE process is executing

SQL > @ getsql_by_spid.sql Enter value for pid: 11741 old 13: WHERE c.spid ='& pid')) new 13: WHERE c.spid = '11741')) SQL_TEXT-- -. (in the real world, the SQL statement is output here.)

The getsql_by_spid.sql script is as follows:

SELECT / * + ORDERED * / sql_text FROM v$sqltext a WHERE (a.hash_value, a.address) IN (SELECT DECODE (sql_hash_value, 0, prev_hash_value, sql_hash_value), DECODE (sql_hash_value, 0 Prev_sql_addr, sql_address) FROM v$session b WHERE b.paddr = (SELECT addr FROM v$process c WHERE c.spid ='& pid')) ORDER BY piece ASC /

Here are only a few examples, because the iotop command is very simple, after understanding the parameters and shortcuts of iotop, basically only need to obtain the process or information according to the actual needs of the Imax O information, the rest is the analysis and judgment.

The above is what the editor shares with you what is the monitoring tool Linux iotop. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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