mysql fio测试_fio_飞哥最爱白菜_新浪博客

#yum install git

#yum install gtk*

#git clone git://git.kernel.dk/fio.git

# cd fio

# ./configure --enable-gfio

#make fio

#make gfio

fio --filename=/dev/sdb --direct=1 --rw=write --bs=4k --size=15G

--numjobs=64 --runtime=300 --group_reporting --name=test-read

fio的输出非常详细,下面是4k随机写的一个测试的结果,可以看到有写吞吐、iops指标,还有cpu利用率、磁盘状态等指标。

filename=/dev/sdb1 测试文件名称,通常选择需要测试的盘的data目录。

direct=1 true,则标明采用non-buffered

io.同O_DIRECT效果一样。ZFS和Solaris不支持direct io,在windows同步IO引擎不支持direct io

,测试过程绕过机器自带的buffer。使测试结果更真实。

buffered=bool true,则标明采用buffered io。是direct的反义词,默认是true

rw=[read|write|randwrite|randread|rw,readwrite|randrw]

bs=16k 单次io的块文件大小为16k

bsrange=512-2048 同上,提定数据块的大小范围

size=5g 本次的测试文件大小为5g,以每次4k的io进行测试。

numjobs=30 本次的测试线程为30.

runtime=1000 测试时间为1000秒,如果不写则一直将5g文件分4k每次写完为止。

ioengine=[sync|sync] io引擎方式

rwmixwrite=30 在混合读写的模式下,写占30%

group_reporting 关于显示结果的,汇总每个进程的信息。

iodepth=1

加于文件之上的保持的IO单元。默认对于每个文件来说是1,可以设置一个更大的值来提供并发度。iodepth大于1不会影响同步IO引擎(除非verify_async这个选项被设置)。even

async engines may impose OS restrictions causing the desired depth

not to be achieved.

这会在Linux使用libaio并且设置direct=1的时候发生,因为buffered

io在OS中不是异步的。在外部通过类似于iostat这些工具来观察队列深度来保证这个IO队列深度是我们想要的。这个可以参考褚霸的博客http://blog.yufeng.info/archives/2104

nrfiles=8 每个进程生成文件的数量。

openfiles=int 在同一时间可以同时打开的文件数目,默认同nrfiles相等,可以设置小一些,来限制同时打开的文件数目。

输出

在运行时,fio将打印当前job创建的状态

Threads: 1: [_r] [24.8% done] [ 13509/ 8334 kb/s] [eta 00h:01m:31s]

生命周期

P 线程已经启动,还没有启动

C 线程启动

I 纯种已经初始化,等待中

p 线程运行中,预读文件

R 顺序读

r 随机读

W 顺序写

w 随机写

M 混合顺序读写

m 混合随机读写

F 等待执行fsync()

V 运行,检验写的数据

E 线程退出,还没有被主线程获取状态

_ Thread reaped, or

X Thread reaped, exited with an error.

K Thread reaped, exited due to signal.

其它的值都是可以自解释的:

当前正在运行的IO线程数。

从上次检查之后的IO速度(读速度/写速度)

估计的完成百分比

整个group的估计完成时间

当fio完成的时候(或是通过ctrl-c终止的时候),将会打印每一个线程的数据,每个group的数据,和磁盘数据。

io= 执行了多少M的IO

bw= 平均IO带宽

iops= IOPS

runt= 线程运行时间

slat 提交延迟

clat 完成延迟

lat响应时间

bw 带宽

cpu利用率

IO depths=io队列

IO submit=单个IO提交要提交的IO数

IO complete= Like the above submit number, but for completions

instead.

IO issued= The number of read/write requests issued, and how

many

of them were short.

IO latencies=IO完延迟的分布

io= 总共执行了多少size的IO

aggrb= group总带宽

minb= 最小平均带宽.

maxb= 最大平均带宽.

mint= group中线程的最短运行时间.

maxt= group中线程的最长运行时间.

ios= 所有group总共执行的IO数.

merge= 总共发生的IO合并数.

ticks= Number of ticks we kept the disk busy.

io_queue= 花费在队列上的总共时间.

util= 磁盘利用率

--fio test script --

cat fio_tesh.sh

Device="vdb"

DD=`date +%Y-%m-%d-%H`

filename=/mnt/fio/test_fio #test filename#

#ioengine=[sync psync libaio] io flush type#

#rw_type=[read write randread randwrite readwrite randrw]#

#blocksize=[1k 4k 8k 16k 32k]#

runtime=100

size=1G

numjobs=16

if test -d /tmp/fio/$DD

then

echo "directory exists. "

echo "please wait a moment"

exit

else

mkdir -p /tmp/fio/$DD

mkdir -p /tmp/fio/

fi

for ioengine in sync psync libaio

do

if test -d

/tmp/fio/$DD/$ioengine

then echo "directory exists "

exit

else

mkdir -p /tmp/fio/$DD/$ioengine

fi

cd /tmp/fio/$DD/$ioengine

for rwtype

in read write randread randwrite readwrite randrw

do

for blocksize in 1k 4k 8k 16k

32k

do

echo "##the iostatus when fio test

$rwtype,$blocksize,$ioengine ##"

iostat

-xmN 1 1 |grep 'Device'>>$rwtype_io.txt

iostat -xmN 2|grep --line-buffered -A

0 ${Device} > $rwtype_io.txt &

echo "###fio test $rwtype,$blocksize,$ioengine

####">>$rwtype.txt

fio -filename=${filename} -direct=1 -iodepth=64

-rw=$rwtype -ioengine=$ioengine -bs=$blocksize

-size=$size -numjobs=$numjobs -runtime=$runtime

-group_reporting -name=mytest >>$rwtype.txt

echo '#' >>$rwtype.txt

echo '#' >>$rwtype.txt

echo '#' >>$rwtype.txt

kill

-9 $(ps -ef|grep iostat|grep $$|gawk '$0 !~/grep/ {print $2}' |tr

-s '\n' ' ')

sleep 30

done

done

done

kill -9 $(ps -ef|grep iostat|grep $$|gawk '$0 !~/grep/ {print $2}'

|tr -s '\n' ' ')

--fio 模拟MySQL 测试配置文件---

# QPS: 40000(10 cores) # Dataset: 200G # R/W: 8/2 # ThreadPool Num: 64 # IO ThreadNum: 32 [global] runtime=86400 time_based group_reporting directory=/your_dir ioscheduler=deadline refill_buffers [mysql-binlog] filename=test-mysql-bin.log bsrange=512-1024 ioengine=sync

rw=write size=24G sync=1 rw=write overwrite=1 fsync=100 rate_iops=64 invalidate=1 numjobs=64

[innodb-data] filename=test-innodb.dat bs=16K ioengine=psync rw=randrw size=200G direct=1 rwmixread=80 numjobs=32 thinktime=600 thinktime_spin=200 thinktime_blocks=2 [innodb-trxlog] filename=test-innodb.log bsrange=512-2048 ioengine=sync

rw=write size=2G fsync=1 overwrite=1 rate_iops=64 invalidate=1 numjobs=64

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值