0%

iotop命令

哪个程序占用了磁盘IO?

查看一台主机的监控,有时候我们会发现磁盘IO被打满了,这时候怎样定位出是哪个程序大量占用了磁盘IO?
答:使用磁盘IO分析工具。比如iotop,可以监控到读写磁盘的线程和读写速度。

参考文档:

安装iotop

yum install iotop

使用iotop

显示当前主机的IO情况
iotop

输出内容说明

  • Thread ID (TID).
  • I/O Priority class/level (PRIO).
  • the owner of the thread with TID (USER).
  • the disk read per second (DISK READ).
  • the disk write per second (DISK WRITE).
  • the percentage of time the thread spent while swapping in (SWAPIN).
  • the percentage of time the thread spent waiting on I/O (IO>).
  • the command the thread is running (COMMAND).

根据线程号查找进程

已知线程号(例如34567),怎样查找对应的进程号?

方法一:直接查找线程号
ps -efL | grep 34567

方法二:根据COMMAND关键字(例如nginx)查找进程号,然后查看进程包含的线程号,最后和要查找的线程号进行对比。

1
2
ps -ef | grep nginx
ps -T -p 12345
  • 本文作者: 好好学习的郝
  • 本文链接: https://www.voidking.com/dev-iotop/
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!源站会及时更新知识点及修正错误,阅读体验也更好。欢迎分享,欢迎收藏~