Linux 如何找到经常做io的进程?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5167794/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 03:05:23  来源:igfitidea点击:

how to find the process that is doing io frequently?

linuxiocommand

提问by cheng

I am using ubuntu. There are some processes that are doing io frequently on my server, even a "ls" command will cost 1 second to execute. I want to find out which process is doing io so heavily, is there any good command or tool?

我正在使用 ubuntu。我的服务器上有一些进程经常执行 io,即使是“ls”命令也会花费 1 秒来执行。我想知道哪个进程在做io这么重,有什么好的命令或工具吗?

Thanks.

谢谢。

采纳答案by ?imon Tóth

You can use iotopto find processes that are io heavy.

您可以使用iotop来查找 io 繁重的进程。

回答by Petri Lehtinen

iotophas a top-like interface and shows how much I/O reads and writes each process is doing.

iotop有一个类似 top 的界面,并显示每个进程正在执行的 I/O 读取和写入量。

回答by Maxim Egorushkin

You can use atopwhich can report disk reads and writes by processes among many other things.

您可以使用atop,它可以报告进程对磁盘的读写等情况。

Disk utilization — key 'd'

磁盘利用率 — 键 'd'

回答by dogbane

A quick way is to look at the /proc/[PID]/iofile.

一个快速的方法是查看/proc/[PID]/io文件。

Example:

例子:

$ cat /proc/1944/io
read_bytes: 17961091072
write_bytes: 8192000
cancelled_write_bytes: 32768

回答by apporc

you can try pidstat. I found it useful when i need to identify which process made high io.

你可以试试pidstat。当我需要确定哪个进程产生高 io 时,我发现它很有用。