MySQL Hardware--FIO压测
FIO参数
filename=/export/1.txt 支持文件系统或者裸设备,-filename=/dev/sda2或-filename=/dev/sdb direct=1 测试过程绕过机器自带的buffer,使测试结果更真实 rw=randwread 测试随机读的I/O rw=randwrite 测试随机写的I/O rw=randrw 测试随机混合写和读的I/O rw=read 测试顺序读的I/O rw=write 测试顺序写的I/O rw=rw 测试顺序混合写和读的I/O bs=4k 单次io的块文件大小为4k bsrange=512-2048 同上,提定数据块的大小范围 size=5g 本次的测试文件大小为5g,以每次4k的io进行测试 numjobs=30 本次的测试线程为30 runtime=1000 测试时间为1000秒,如果不写则一直将5g文件分4k每次写完为止 ioengine=psync io引擎使用pync方式,如果要使用libaio引擎,需要yum install libaio-devel包 rwmixwrite=30 在混合读写的模式下,写占30% group_reporting 关于显示结果的,汇总每个进程的信息 lockmem=1g 只使用1g内存进行测试 zero_buffers 用0初始化系统buffer nrfiles=8 每个进程生成文件的数量
ioengine参数
sync:Basic read(2) or write(2) I/O. fseek(2) is used to position the I/O location. psync:Basic pread(2) or pwrite(2) I/O. vsync: Basic readv(2) or writev(2) I/O. Will emulate queuing by coalescing adjacents IOs into a single submission. libaio: Linux native asynchronous I/O. posixaio: glibc POSIX asynchronous I/O using aio_read(3) and aio_write(3). mmap: File is memory mapped with mmap(2) and data copied using memcpy(3). splice: splice(2) is used to transfer the data and vmsplice(2) to transfer data from user-space to the kernel. syslet-rw: Use the syslet system calls to make regular read/write asynchronous. sg:SCSI generic sg v3 I/O. net : Transfer over the network. filename must be set appropriately to `host/port’ regardless of data direction. If receiving,only the port argument is used. netsplice: Like net, but uses splice(2) and vmsplice(2) to map data and send/receive. guasi: The GUASI I/O engine is the Generic Userspace Asynchronous Syscall Interface approach to asycnronous I/O.
测试结果解读
4k随机读写,70%读+30%写,30个并发
fio -filename=/export/1.txt -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=4k -size=10G -numjobs=30 -runtime=60 -group_reporting -name=randrw_70read_4k
输出结果:
Jobs: 30 (f=30): [mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] [100.0% done] [99648K/42236K/0K /s] [24.1K/10.6K/0 iops] [eta 00m:00s] randrw_70read_4k: (groupid=0, jobs=30): err= 0: pid=4183: Sun May 5 14:56:16 2019 read : io=5873.2MB, bw=100232KB/s, iops=25057 , runt= 60002msec clat (usec): min=129 , max=17247 , avg=872.95, stdev=884.86 lat (usec): min=129 , max=17247 , avg=873.04, stdev=884.86 clat percentiles (usec): | 1.00th=[ 141], 5.00th=[ 149], 10.00th=[ 157], 20.00th=[ 175], | 30.00th=[ 193], 40.00th=[ 788], 50.00th=[ 988], 60.00th=[ 1096], | 70.00th=[ 1192], 80.00th=[ 1304], 90.00th=[ 1448], 95.00th=[ 1576], | 99.00th=[ 2640], 99.50th=[ 8512], 99.90th=[ 9152], 99.95th=[ 9280], | 99.99th=[10048] bw (KB/s) : min= 2680, max= 3992, per=3.34%, avg=3342.81, stdev=180.17 write: io=2519.1MB, bw=43005KB/s, iops=10751 , runt= 60002msec clat (usec): min=45 , max=21382 , avg=750.66, stdev=874.94 lat (usec): min=45 , max=21382 , avg=750.85, stdev=874.94 clat percentiles (usec): | 1.00th=[ 52], 5.00th=[ 57], 10.00th=[ 60], 20.00th=[ 68], | 30.00th=[ 79], 40.00th=[ 644], 50.00th=[ 868], 60.00th=[ 988], | 70.00th=[ 1080], 80.00th=[ 1192], 90.00th=[ 1320], 95.00th=[ 1448], | 99.00th=[ 1816], 99.50th=[ 8384], 99.90th=[ 9024], 99.95th=[ 9280], | 99.99th=[ 9920] bw (KB/s) : min= 1016, max= 2064, per=3.34%, avg=1434.25, stdev=131.77 lat (usec) : 50=0.06%, 100=11.02%, 250=26.21%, 500=0.67%, 750=2.40% lat (usec) : 1000=13.91% lat (msec) : 2=44.51%, 4=0.41%, 10=0.79%, 20=0.01%, 50=0.01% cpu : usr=0.19%, sys=2.19%, ctx=4148485, majf=0, minf=18446744073708663675 IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% issued : total=r=1503524/w=645100/d=0, short=r=0/w=0/d=0 Run status group 0 (all jobs): READ: io=5873.2MB, aggrb=100231KB/s, minb=100231KB/s, maxb=100231KB/s, mint=60002msec, maxt=60002msec WRITE: io=2519.1MB, aggrb=43005KB/s, minb=43005KB/s, maxb=43005KB/s, mint=60002msec, maxt=60002msec Disk stats (read/write): sda: ios=1499788/643481, merge=0/1, ticks=271811/40234, in_queue=311058, util=98.88%
缩写解释:
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=磁盘利用率
在8块800GB的SSD做RAID 10的存储上使用psync引擎进行测试,测试结果:
4k+70%随机读+30%随机写: 24.1K+10.6K 4k+100%随机读: 127K 4k+100%随机写: 16.2K 1k+70%随机读+30%随机写: 23.4K+10.4K 1k+100%随机读: 131K 1k+100%随机写: 13.8K
上面跑的时间较短,测试误差较大!
抄自:
https://www.cnblogs.com/raykuan/p/6914748.html
http://blog.yufeng.info/archives/1497
http://blog.yufeng.info/archives/677