日韩天堂,国产精品久久久久久久久久一区,羞羞羞网站,自拍视频网站,久久亚洲欧美成人精品,桃花阁成人网在线观看

Hello! 歡迎來到小浪云!


如何尋找IO殺手進程


avatar
小浪云 2024-12-08 202

linux下可以通過iostat查看目前主機總的io使用情況,不過當通過top等命令查看時,發現cpu wait占多過多,想定位具體是哪些程序占用了io,本篇就通過一些常用的手段進行匯總下。

一、top下的wait狀狀

wa = I/O waiting ,wa指的是CPU等待磁盤寫入完成的時間,就是說前提是要進行IO操作,在進行IO操作的時候,CPU等待時間。如一個程序執行的最后,從系統空間到dst硬盤空間的時候,如果程序是阻塞的,那么這個時候cpu就要等待數據寫入磁盤才能完成寫操作了。所以這個時候cpu等待的時間就是wa。

所以wa狀態占比越高,證明IO越繁忙。

我們可以通過以下指令查看當前io的總終態:

[root@361way ~]# sar -u 2 5 Linux 2.6.32-431.29.2.el6.x86_64 (361way) 01/25/2015 _x86_64_ (1 CPU) 06:59:58 PM CPU %user %nice %system %iowait %steal %idle 07:00:00 PM all 1.00 0.00 0.50 0.00 0.00 98.50 07:00:02 PM all 5.05 0.00 1.52 1.01 0.00 92.42 07:00:04 PM all 0.50 0.00 0.50 0.00 0.00 98.99 07:00:06 PM all 0.00 0.00 0.00 0.00 0.00 100.00 07:00:08 PM all 0.50 0.00 0.00 0.50 0.00 98.99 Average: all 1.41 0.00 0.50 0.30 0.00 97.79 [root@361way ~]# vmstat 2 5 procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 98488 209916 218256 0 0 8 28 11 10 5 0 95 0 0 0 0 0 98480 209916 218256 0 0 0 0 155 198 0 0 100 0 0 0 0 0 98496 209916 218256 0 0 0 0 141 191 1 0 99 0 0 0 0 0 98496 209916 218256 0 0 0 0 142 189 0 1 99 0 0 0 0 0 98512 209916 218256 0 0 0 0 152 189 0 0 100 0 0 [root@361way ~]# iostat -x 1 2 Linux 2.6.32-431.29.2.el6.x86_64 (361way) 01/25/2015 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 4.71 0.00 0.42 0.24 0.00 94.63 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util xvda 0.00 0.13 0.31 0.91 14.08 8.30 18.39 0.01 11.84 1.38 0.17 xvdb 0.00 2.12 0.05 3.90 1.52 48.10 12.57 0.05 11.84 0.57 0.22 avg-cpu: %user %nice %system %iowait %steal %idle 0.00 0.00 0.00 0.00 0.00 100.00 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util xvda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 xvdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 
二、找出IO繁忙的進程

可以通過linux下最常用的兩個命令top、ps找出目前正在占用IO的進程。在進行下一步之前我了解一下D狀態,ps命令中查看的狀態有D、R、S、Z、T ,D狀態指不可中斷睡眠 (通常是在IO操作) 收到信號不喚醒和不可運行, 進程必須等待直到有中斷發生。

找出當前進程為D的狀態:

while true; do date; ps auxf | awk '{if($8=="D") print $0;}'; sleep 1; don 

上面的這個操作有一個缺點,就是一旦匹配到一個進程為D的,就開始重新執行下一個循環。而想查看所有當于D狀態的進程,可以將其改為如下:

watch -d -n 1 “(ps aux | awk ‘$8 ~ /D/ { print $0 }’)”

如下,是我在執行一個大文件的cp時,通過上面的指令查看到的結果:

如何尋找IO殺手進程

除此之外,還可以通過專用工具去查看,如iotop或latencytop。這里以iotop為例,執行后會顯示當前的讀寫速度及每個進程占用的速度。執行后可以按o僅顯示占用IO的進程:

[root@361way ~]# iotop --help Usage: /usr/sbin/iotop [OPTIONS] DISK READ and DISK WRITE are the block I/O bandwidth used during the sampling period. SWAPIN and IO are the percentages of time the thread spent respectively while swapping in and waiting on I/O more generally. PRIO is the I/O priority at which the thread is running (set using the ionice command). Controls: left and right arrows to change the sorting column, r to invert the sorting order, o to toggle the --only option, p to toggle the --processes option, a to toggle the --accumulated option, q to quit, any other key to force a refresh. Options: --version show program's version number and exit -h, --help show this help message and exit -o, --only only show processes or threads actually doing I/O -b, --batch non-interactive mode -n NUM, --iter=NUM number of iterations before ending [infinite] -d SEC, --delay=SEC delay between iterations [1 second] -p PID, --pid=PID processes/threads to monitor [all] -u USER, --user=USER users to monitor [all] -P, --processes only show processes, not all threads -a, --accumulated show accumulated I/O instead of bandwidth -k, --kilobytes use kilobytes instead of a human friendly unit -t, --time add a timestamp on each line (implies --batch) -q, --quiet suppress some lines of header (implies --batch) 

相關閱讀

主站蜘蛛池模板: 精品视频一区二区 | 羞羞视频在线看 | 四虎最新网址入口 | 欧美国产成人精品一区二区三区 | 播色网 | 国产成人亚洲精品 | 一本岛在免费一二三区 | 亚洲一区二区三区四区视频 | 亚洲第一区视频在线观看 | 欧美自拍区| 亚洲精品99久久久久中文字幕 | 四虎亚洲国产成人久久精品 | 亚洲福利视频网址 | 国产污片在线观看 | 国内精品 大秀视频 日韩精品 | 比基尼派对电影完整版在线观看 | 中文字幕国产精品 | 四虎永久在线精品波多野结衣 | 国产麻豆精品在线 | 永久免费精品视频 | 久久精品国产免费看久久精品 | 亚洲国产精品成人综合久久久 | 亚洲高清在线看 | 久久精品国产精品2020 | 自偷自偷自亚洲永久 | www.99| 一本久道热中字伊人 | 夜色资源站www国产在线资源 | 午夜视频在线观看按摩女 | 久久综合九色综合97免费下载 | 伊人精品影院 | 亚洲国产成人久久一区www | 久久精品成人欧美大片免费 | 色偷偷亚洲男人天堂 | 久久久最新精品 | 亚洲伊人成综合成人网 | 久久亚洲精品中文字幕二区 | 欧美gogo高清bbw | 日本a在线天堂 | 色月| 在线亚洲欧美日韩 |