操作系统IO过高,可以通过基础工具 top/iostat 查看
通过 top 的 %cpu 的wa(wait)指标
1
#top
iostat 的%util 指标
1
#iostat -dx 1
如何定位具体哪个进程/服务造成io过高呢?
最简单的可以通过 iotop 定位, 通过IO百分比定位进程
通过判断进程是 D状态 定位
1
for x in `seq 1 1 10`; do ps -eo state,pid,cmd | grep "^D"; echo "----"; sleep 5; done
ps 进程状态
1
2
3
4
5
6
7
8PROCESS STATE CODES
D uninterruptible sleep (usually IO)
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent.
定位哪个文件造成IO过高,可以通过 lsof 或者 pt-ioprofile 跟踪进程pid来继续定位