Linux IO问题

最近一个linux服务器异常, it was pretty slow and many program had no

response even halted. 几天后明显, we found that the load is too

high the mainly reason is that disk I/O near 100%.

So this artical will show you how to check disk load, in order to slove the same problem more quickly.

 

Firstly, 执行 最佳 命令.

最佳 – 16:15:05 向上 6 天, 6:25, 2 使用者, 平均负载: 1.45, 1.77, 2.14

任务: 147 总, 1 跑步, 146 睡眠, 0 停止了, 0 僵尸

中央处理器(s): 0.2% 我们, 0.2% 他的, 0.0% 你, 86.9% ID, 12.6% wa, 0.0% 你好, 0.0% 和

m: 4037872总k, 4003648使用的k, 34224免费, 5512k个缓冲区

交换: 7164948总k, 629192使用的k, 6535756免费, 3511184k缓存

 

You can find “12.6%” wa easily,If you find wa is lager than 30%, it indicat IO load high.

 

Secondly, you can runiostat -x 1 10

But you must install iostat through by executingyum install sysstatif iostat

can not be found.

avg-cpu: %user %nice %sys %iowait %idle

0.00 0.00 0.25 33.46 66.29

Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util

sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

sdb 0.00 1122 17.00 9.00 192.00 9216.00 96.00 4608.00 123.79 137.23 1033.43 13.17 100.10

sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

check %util 100.10 %空闲 66.29

如果 “%有用” is closed to 100%,it means there are too many I/O requestsI/O has already full load

and there may exist bottleneck of storage system.

If idle is equel 70% ,this indicate IO stess high, There are many waits.

you can comm

 

If you need to test I/O performance of a disk ,you can execute the following command

time dd if=/dev/zero bs=1M count=2048 of=direct_2G

this comand can create a file which size is 2GB in current directory.So, we can test I/O

load during the file creation.

The following script can check I/O status when peak hours.

monitor_io_stats.sh

#!/重启MySQL即可生效

/etc/init.d/syslog stop

回声 1 > /proc/sys/vm/block_dump

重启MySQL即可生效 60

dmesg | awk ‘/(READ|WRITE|dirtied)/ {process[$1]++} 结尾 {for (x in process) \

print process[X],X}’ |sort -nr |awk‘{打印 $2 ” ” $1}’ | \

head -n 10

回声 0 > /proc/sys/vm/block_dump

/etc/init.d/syslog start

 

source url http://www.cnblogs.com/mfryf/archive/2012/03/12/2392012.html

发表评论