一个计算机技术爱好者与学习者

0%

iotop命令

1. 哪个程序占用了磁盘IO?

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

参考文档:

2. 安装iotop

yum install iotop

3. 使用iotop

显示当前主机的IO情况
iotop

4. 输出内容说明

  • 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).

5. 根据线程号查找进程

已知线程号(例如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 许可协议,转载请注明出处!源站会即时更新知识点并修正错误,欢迎访问~
  • 微信公众号同步更新,欢迎关注~