- 首先是top查看一下系统状况
发现两个参数异常,一是平均负载高,一是cpu %wa一直在50%以上。
查了一下%wa参数的意义:就是等待IO的时间
wa -- iowait
Amount of time the CPU has been waiting for I/O to complete.
- 查看磁盘使用情况
> PROCESS 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.
- 查看到进程中状态D(disk sleep)的进程
for x in `seq 1 1 10`; do ps -eo state,pid,cmd | grep "^D"; echo "----"; sleep 5; done
- 查看进程相关状态信息
cat /proc/487/io
rchar: 48752567
wchar: 549961789
syscr: 5967
syscw: 67138
read_bytes: 49020928
write_bytes: 549961728
cancelled_write_bytes: 0
查看都往哪写东西了
lsof -p 487
就是查看引起进程该状态的原因