首先 、用top命令查看
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
查看12.6% wa
IO等待所占用的CPU时间的百分比,高过30%时IO压力高
其次、 用 iostat -x 1 10
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
查看%util 100.10 %idle 66.29
如果 %util 接近 100%,说明产生的I/O请求太多,I/O系统已经满负荷,该磁盘可能存在瓶颈。
idle小于70% IO压力就较大了,一般读取速度有较多的wait.
同时可以结合vmstat 查看查看b参数(等待资源的进程数)
vmstat 1
如果你想对硬盘做一个IO负荷的压力测试可以用如下命令:
time有计时作用,dd用于复制,从if读出,写到of。if=/dev/zero不产生IO,因此可以用来测试纯写速度。同理of=/dev/null不产生IO,可以用来测试纯读速度。bs是每次读或写的大小,即一个块的大小,count是读写块的数量。
1.测/目录所在磁盘的纯写速度:
# time dd if=/dev/zero bs=1024 count=1000000 of=/1Gb.file
2.测/目录所在磁盘的纯读速度:
# dd if=/kvm/ftp/other/1Gb.file bs=64k |dd of=/dev/null
3.测读、写速度:
# dd if=/vat/test of=/oradata/test1 bs=64k
# time dd if=/dev/zero bs=1M count=2048 of=direct_2G
(此命令为在当前目录下新建一个2G的文件)
[@more@]
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23682146/viewspace-1055809/
,如需转载,请注明出处,否则将追究法律责任。