创建目录
mkdir -p /opt/ioTest/
mkdir -p /opt/ioTest/
cd /opt/ioTest/
time计时,dd用于复制,从if读出,写到of
if=/dev/zero不产生IO,因此可以用来测试纯写速度
of=/dev/null不产生IO,可以用来测试纯读速度
测试写速度:
time dd if=/dev/zero of=/opt/ioTest/out bs=8k oflag=direct count=500000
测试读速度:
time dd if=/opt/ioTest/out of=/dev/null bs=8k
测试读写速度:
cp /opt/ioTest/out /opt/ioTest/in
time dd if=/opt/ioTest/in of=/opt/ioTest/out bs=8k oflag=direct
使用fio测试iops
wget http://brick.kernel.dk/snaps/fio-3.16.tar.gz
yum install libaio-devel
tar -zxvf fio-3.16.tar.gz
cd fio-3.16
make
make install
顺序读:
fio -filename=/opt/ioTest/out -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest
随机写:
fio -filename=/opt/ioTest/out -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest
顺序写:
fio -filename=/opt/ioTest/out -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest
混合随机读写:
fio -filename=/opt/ioTest/out -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest -ioscheduler=noop