Linux IO issue
a linux server abnormal recently, it was pretty slow and many program had no
response even halted. obvioused a couple of days, 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, execute top command.
top – 16:15:05 up 6 days, 6:25, 2 users, load average: 1.45, 1.77, 2.14
Tasks: 147 total, 1 running, 146 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.2% us, 0.2% sy, 0.0% ni, 86.9% id, 12.6% wa, 0.0% hi, 0.0% si
Mem: 4037872k total, 4003648k used, 34224k free, 5512k buffers
Swap: 7164948k total, 629192k used, 6535756k free, 3511184k cached
You can find “12.6%” wa easily,If you find wa is lager than 30%, it indicat IO load high.
Secondly, you can run “iostat -x 1 10”
But you must install iostat through by executing “yum install sysstat” if 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 %idle 66.29
if “%util” is closed to 100%,it means there are too many I/O requests,I/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
#!/bin/sh
/etc/init.d/syslog stop
echo 1 > /proc/sys/vm/block_dump
sleep 60
dmesg | awk ‘/(READ|WRITE|dirtied)/ {process[$1]++} END {for (x in process) \
print process[x],x}’ |sort -nr |awk ‘{print $2 ” ” $1}’ | \
head -n 10
echo 0 > /proc/sys/vm/block_dump
/etc/init.d/syslog start
source url http://www.cnblogs.com/mfryf/archive/2012/03/12/2392012.html