共計 1515 個字符,預計需要花費 4 分鐘才能閱讀完成。
這篇文章主要介紹 Linux 服務器高 I / O 等待延遲問題查找的示例分析,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
0. 首先是 top 查看一下系統狀況
發現兩個參數異常,一是平均負載高,一是 cpu %wa 一直在 50% 以上。
查了一下 %wa 參數的意義:
wa -- iowait Amount of time the CPU has been waiting for I/O to complete.
1. 查看磁盤讀寫數據
用 iostat 查看磁盤狀況
$ iostat -x 2 5 avg-cpu: %user %nice %system %iowait %steal %idle 3.66 0.00 47.64 48.69 0.00 0.00 Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util sda 44.50 39.27 117.28 29.32 11220.94 13126.70 332.17 65.77 462.79 9.80 2274.71 7.60 111.41 dm-0 0.00 0.00 83.25 9.95 10515.18 4295.29 317.84 57.01 648.54 16.73 5935.79 11.48 107.02 dm-1 0.00 0.00 57.07 40.84 228.27 163.35 8.00 93.84 979.61 13.94 2329.08 10.93 107.02
2. 查看進程狀態
進程狀態表
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
查看到有 kjournald 這個進程
查看這個進程是做什么的?
kjournald 是 ext3 文件系統記錄文件系統日志的進程。
查看進程相關狀態信息
# 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
引起 kjournald 狀態 D 的原因還在查。。。。
以上是“Linux 服務器高 I / O 等待延遲問題查找的示例分析”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注丸趣 TV 行業資訊頻道!
正文完