linux 磁盘性能测试工具fio

时间:2022-09-16 08:46:45

1,安装

apt-get install fio
dd if=/dev/zero of=2G.file bs=1G count=2

2,测试

fio -filename=/mnt/dmcache/chenming.log -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest

3,ssd随机读4k

 fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=4k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest

结果:

root@demo-2:/mnt/ssd# fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=4k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
mytest: (g=0): rw=randread, bs=4K-4K/4K-4K, ioengine=psync, iodepth=1
...
mytest: (g=0): rw=randread, bs=4K-4K/4K-4K, ioengine=psync, iodepth=1
2.0.8
Starting 10 threads
mytest: Laying out IO file(s) (1 file(s) / 2048MB)
^Cbs: 10 (f=10): [rrrrrrrrrr] [8.4% done] [6408K/0K /s] [1602 /0 iops] [eta 15m:16s]
fio: terminating on signal 2

mytest: (groupid=0, jobs=10): err= 0: pid=11710
read : io=541852KB, bw=6475.2KB/s, iops=1618 , runt= 83682msec
clat (usec): min=109 , max=59439 , avg=6173.66, stdev=1276.72
lat (usec): min=110 , max=59440 , avg=6173.96, stdev=1276.71
clat percentiles (usec):
| 1.00th=[ 1224], 5.00th=[ 4640], 10.00th=[ 5152], 20.00th=[ 5600],
| 30.00th=[ 5856], 40.00th=[ 6048], 50.00th=[ 6176], 60.00th=[ 6368],
| 70.00th=[ 6560], 80.00th=[ 6816], 90.00th=[ 7200], 95.00th=[ 7712],
| 99.00th=[ 9920], 99.50th=[10944], 99.90th=[13760], 99.95th=[15168],
| 99.99th=[27776]
bw (KB/s) : min= 592, max= 2019, per=10.00%, avg=647.72, stdev=97.77
lat (usec) : 250=0.03%, 500=0.06%, 750=0.10%, 1000=0.38%
lat (msec) : 2=1.13%, 4=1.43%, 10=95.90%, 20=0.95%, 50=0.01%
lat (msec) : 100=0.01%
cpu : usr=1.26%, sys=4.56%, ctx=1445122, majf=0, minf=3596
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=135463/w=0/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
READ: io=541852KB, aggrb=6475KB/s, minb=6475KB/s, maxb=6475KB/s, mint=83682msec, maxt=83682msec

Disk stats (read/write):
vdb: ios=135349/2, merge=0/16, ticks=830612/4, in_queue=1233332, util=100.00%

4,ssd随机读写512k

fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=512k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest

结果:

root@demo-2:/mnt/ssd# fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=512k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
mytest: (g=0): rw=randread, bs=512K-512K/512K-512K, ioengine=psync, iodepth=1
...
mytest: (g=0): rw=randread, bs=512K-512K/512K-512K, ioengine=psync, iodepth=1
2.0.8
Starting 10 threads
^Cbs: 10 (f=10): [rrrrrrrrrr] [15.9% done] [91976K/0K /s] [179 /0 iops] [eta 03m:10s]
fio: terminating on signal 2

mytest: (groupid=0, jobs=10): err= 0: pid=11722
read : io=3248.6MB, bw=94722KB/s, iops=185 , runt= 35118msec
clat (usec): min=305 , max=243343 , avg=54005.99, stdev=11215.77
lat (usec): min=306 , max=243344 , avg=54006.34, stdev=11215.77
clat percentiles (msec):
| 1.00th=[ 5], 5.00th=[ 50], 10.00th=[ 53], 20.00th=[ 54],
| 30.00th=[ 55], 40.00th=[ 56], 50.00th=[ 56], 60.00th=[ 57],
| 70.00th=[ 57], 80.00th=[ 58], 90.00th=[ 59], 95.00th=[ 60],
| 99.00th=[ 62], 99.50th=[ 71], 99.90th=[ 186], 99.95th=[ 208],
| 99.99th=[ 243]
bw (KB/s) : min= 5965, max=32125, per=10.02%, avg=9488.05, stdev=2185.98
lat (usec) : 500=0.12%, 750=0.02%, 1000=0.11%
lat (msec) : 2=0.03%, 4=0.48%, 10=2.46%, 20=0.26%, 50=1.68%
lat (msec) : 100=94.63%, 250=0.22%
cpu : usr=0.23%, sys=1.99%, ctx=101804, majf=0, minf=11135
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=6497/w=0/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
READ: io=3248.6MB, aggrb=94722KB/s, minb=94722KB/s, maxb=94722KB/s, mint=35118msec, maxt=35118msec

Disk stats (read/write):
vdb: ios=6475/0, merge=0/0, ticks=349068/0, in_queue=349328, util=99.85%

5,ssd顺序读4k

fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=4k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest

结果:

root@demo-2:/mnt/ssd# fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=4k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
mytest: (g=0): rw=read, bs=4K-4K/4K-4K, ioengine=psync, iodepth=1
...
mytest: (g=0): rw=read, bs=4K-4K/4K-4K, ioengine=psync, iodepth=1
2.0.8
Starting 10 threads
^Cbs: 10 (f=10): [RRRRRRRRRR] [4.6% done] [6397K/0K /s] [1599 /0 iops] [eta 15m:54s]
fio: terminating on signal 2

mytest: (groupid=0, jobs=10): err= 0: pid=11735
read : io=295608KB, bw=6541.7KB/s, iops=1635 , runt= 45189msec
clat (usec): min=152 , max=40472 , avg=6111.80, stdev=1142.23
lat (usec): min=152 , max=40473 , avg=6112.08, stdev=1142.23
clat percentiles (usec):
| 1.00th=[ 572], 5.00th=[ 5408], 10.00th=[ 5536], 20.00th=[ 5664],
| 30.00th=[ 5728], 40.00th=[ 5920], 50.00th=[ 6176], 60.00th=[ 6560],
| 70.00th=[ 6752], 80.00th=[ 6816], 90.00th=[ 6944], 95.00th=[ 7072],
| 99.00th=[ 7456], 99.50th=[ 7968], 99.90th=[ 9792], 99.95th=[11456],
| 99.99th=[37632]
bw (KB/s) : min= 632, max= 1924, per=10.01%, avg=654.54, stdev=134.62
lat (usec) : 250=0.01%, 500=0.30%, 750=1.85%, 1000=0.19%
lat (msec) : 2=0.19%, 4=0.20%, 10=97.17%, 20=0.08%, 50=0.01%
cpu : usr=0.81%, sys=3.44%, ctx=786778, majf=0, minf=2021
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=73902/w=0/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
READ: io=295608KB, aggrb=6541KB/s, minb=6541KB/s, maxb=6541KB/s, mint=45189msec, maxt=45189msec

Disk stats (read/write):
vdb: ios=73647/0, merge=0/0, ticks=447360/0, in_queue=447296, util=99.88%

6,ssd顺序读512k

fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=512k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
root@demo-2:/mnt/ssd# fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=512k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
mytest: (g=0): rw=read, bs=512K-512K/512K-512K, ioengine=psync, iodepth=1
...
mytest: (g=0): rw=read, bs=512K-512K/512K-512K, ioengine=psync, iodepth=1
2.0.8
Starting 10 threads
^Cbs: 10 (f=10): [RRRRRRRRRR] [13.6% done] [92579K/0K /s] [180 /0 iops] [eta 03m:29s]
fio: terminating on signal 2

mytest: (groupid=0, jobs=10): err= 0: pid=11747
read : io=3048.0MB, bw=94975KB/s, iops=185 , runt= 32863msec
clat (usec): min=331 , max=835723 , avg=53863.64, stdev=96883.54
lat (usec): min=331 , max=835724 , avg=53863.96, stdev=96883.54
clat percentiles (msec):
| 1.00th=[ 3], 5.00th=[ 5], 10.00th=[ 6], 20.00th=[ 6],
| 30.00th=[ 7], 40.00th=[ 12], 50.00th=[ 23], 60.00th=[ 28],
| 70.00th=[ 34], 80.00th=[ 40], 90.00th=[ 190], 95.00th=[ 239],
| 99.00th=[ 490], 99.50th=[ 562], 99.90th=[ 734], 99.95th=[ 791],
| 99.99th=[ 840]
bw (KB/s) : min= 721, max=27592, per=10.20%, avg=9688.29, stdev=4272.85
lat (usec) : 500=0.02%
lat (msec) : 2=0.79%, 4=2.82%, 10=28.20%, 20=11.63%, 50=39.40%
lat (msec) : 100=2.33%, 250=10.33%, 500=3.56%, 750=0.85%, 1000=0.07%
cpu : usr=0.27%, sys=1.48%, ctx=95488, majf=0, minf=12370
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=6096/w=0/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
READ: io=3048.0MB, aggrb=94974KB/s, minb=94974KB/s, maxb=94974KB/s, mint=32863msec, maxt=32863msec

Disk stats (read/write):
vdb: ios=6627/0, merge=0/0, ticks=353728/0, in_queue=355280, util=99.82%

7,ssd 随机写4k

fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=4k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
root@demo-2:/mnt/ssd# fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=4k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
mytest: (g=0): rw=randwrite, bs=4K-4K/4K-4K, ioengine=psync, iodepth=1
...
mytest: (g=0): rw=randwrite, bs=4K-4K/4K-4K, ioengine=psync, iodepth=1
2.0.8
Starting 10 threads
^Cbs: 10 (f=10): [wwwwwwwwww] [5.4% done] [0K/6408K /s] [0 /1602 iops] [eta 15m:47s]
fio: terminating on signal 2

mytest: (groupid=0, jobs=10): err= 0: pid=11759
write: io=351520KB, bw=6517.2KB/s, iops=1629 , runt= 53938msec
clat (usec): min=96 , max=1077.4K, avg=6134.29, stdev=52490.83
lat (usec): min=96 , max=1077.4K, avg=6134.62, stdev=52490.84
clat percentiles (usec):
| 1.00th=[ 108], 5.00th=[ 115], 10.00th=[ 120], 20.00th=[ 127],
| 30.00th=[ 135], 40.00th=[ 151], 50.00th=[ 175], 60.00th=[ 251],
| 70.00th=[ 1176], 80.00th=[ 1192], 90.00th=[ 1224], 95.00th=[ 1256],
| 99.00th=[342016], 99.50th=[428032], 99.90th=[815104], 99.95th=[970752],
| 99.99th=[1044480]
bw (KB/s) : min= 3, max= 3120, per=11.21%, avg=730.27, stdev=548.60
lat (usec) : 100=0.10%, 250=59.86%, 500=2.84%, 750=0.23%, 1000=0.09%
lat (msec) : 2=35.32%, 4=0.15%, 10=0.03%, 20=0.01%, 50=0.01%
lat (msec) : 100=0.02%, 250=0.16%, 500=1.04%, 750=0.04%, 1000=0.07%
lat (msec) : 2000=0.03%
cpu : usr=0.94%, sys=4.49%, ctx=1824233, majf=0, minf=2312
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=0/w=87880/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
WRITE: io=351520KB, aggrb=6517KB/s, minb=6517KB/s, maxb=6517KB/s, mint=53938msec, maxt=53938msec

Disk stats (read/write):
vdb: ios=0/87552, merge=0/10, ticks=0/58580, in_queue=58496, util=95.24%

8,ssd随机写512k

root@demo-2:/mnt/ssd# fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=512k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
mytest: (g=0): rw=randwrite, bs=512K-512K/512K-512K, ioengine=psync, iodepth=1
...
mytest: (g=0): rw=randwrite, bs=512K-512K/512K-512K, ioengine=psync, iodepth=1
2.0.8
Starting 10 threads
^Cbs: 10 (f=10): [wwwwwwwwww] [6.3% done] [0K/92067K /s] [0 /179 iops] [eta 03m:57s]
fio: terminating on signal 2

mytest: (groupid=0, jobs=10): err= 0: pid=11773
write: io=1517.6MB, bw=97971KB/s, iops=191 , runt= 15861msec
clat (usec): min=294 , max=1705.5K, avg=52154.15, stdev=246369.13
lat (usec): min=305 , max=1705.5K, avg=52165.81, stdev=246369.08
clat percentiles (usec):
| 1.00th=[ 342], 5.00th=[ 836], 10.00th=[ 4448], 20.00th=[ 5344],
| 30.00th=[ 5408], 40.00th=[ 5472], 50.00th=[ 5472], 60.00th=[ 5472],
| 70.00th=[ 5536], 80.00th=[ 5920], 90.00th=[ 6368], 95.00th=[ 6944],
| 99.00th=[1466368], 99.50th=[1515520], 99.90th=[1597440], 99.95th=[1695744],
| 99.99th=[1712128]
bw (KB/s) : min= 311, max=92261, per=10.21%, avg=10004.05, stdev=9746.29
lat (usec) : 500=3.33%, 750=1.32%, 1000=0.86%
lat (msec) : 2=1.42%, 4=0.76%, 10=88.24%, 20=0.13%, 50=0.13%
lat (msec) : 100=0.13%, 250=0.03%, 500=0.10%, 750=0.20%, 1000=0.10%
lat (msec) : 2000=3.26%
cpu : usr=0.36%, sys=1.54%, ctx=78304, majf=0, minf=5811
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=0/w=3035/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
WRITE: io=1517.6MB, aggrb=97971KB/s, minb=97971KB/s, maxb=97971KB/s, mint=15861msec, maxt=15861msec

Disk stats (read/write):
vdb: ios=0/3009, merge=0/3, ticks=0/15824, in_queue=15820, util=98.01%

9,ssd 顺序写4k

root@demo-2:/mnt/ssd# fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=4k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
mytest: (g=0): rw=write, bs=4K-4K/4K-4K, ioengine=psync, iodepth=1
...
mytest: (g=0): rw=write, bs=4K-4K/4K-4K, ioengine=psync, iodepth=1
2.0.8
Starting 10 threads
^Cbs: 10 (f=10): [WWWWWWWWWW] [3.1% done] [0K/6404K /s] [0 /1601 iops] [eta 16m:10s]
fio: terminating on signal 2

mytest: (groupid=0, jobs=10): err= 0: pid=11785
write: io=201056KB, bw=6607.7KB/s, iops=1651 , runt= 30428msec
clat (usec): min=91 , max=659459 , avg=6050.28, stdev=48579.09
lat (usec): min=91 , max=659459 , avg=6050.61, stdev=48579.10
clat percentiles (usec):
| 1.00th=[ 113], 5.00th=[ 133], 10.00th=[ 161], 20.00th=[ 225],
| 30.00th=[ 251], 40.00th=[ 270], 50.00th=[ 298], 60.00th=[ 346],
| 70.00th=[ 1192], 80.00th=[ 1288], 90.00th=[ 1336], 95.00th=[ 1384],
| 99.00th=[391168], 99.50th=[448512], 99.90th=[509952], 99.95th=[552960],
| 99.99th=[626688]
bw (KB/s) : min= 6, max= 3046, per=10.68%, avg=705.74, stdev=447.33
lat (usec) : 100=0.06%, 250=29.28%, 500=36.03%, 750=0.48%, 1000=0.08%
lat (msec) : 2=32.58%, 4=0.15%, 10=0.03%, 20=0.02%, 50=0.01%
lat (msec) : 100=0.03%, 250=0.03%, 500=1.13%, 750=0.11%
cpu : usr=0.99%, sys=4.39%, ctx=1043195, majf=0, minf=1399
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=0/w=50264/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
WRITE: io=201056KB, aggrb=6607KB/s, minb=6607KB/s, maxb=6607KB/s, mint=30428msec, maxt=30428msec

Disk stats (read/write):
vdb: ios=0/49909, merge=0/6, ticks=0/29100, in_queue=29068, util=94.80%

10,ssd顺序写512k

root@demo-2:/mnt/ssd# fio -filename=/mnt/ssd/chenming.log -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=512k -size=2G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
mytest: (g=0): rw=write, bs=512K-512K/512K-512K, ioengine=psync, iodepth=1
...
mytest: (g=0): rw=write, bs=512K-512K/512K-512K, ioengine=psync, iodepth=1
2.0.8
Starting 10 threads
^Cbs: 10 (f=10): [WWWWWWWWWW] [15.0% done] [0K/91792K /s] [0 /179 iops] [eta 03m:35s]
fio: terminating on signal 2

mytest: (groupid=0, jobs=10): err= 0: pid=11798
write: io=3490.6MB, bw=94615KB/s, iops=184 , runt= 37777msec
clat (usec): min=245 , max=1621.8K, avg=54061.85, stdev=246588.51
lat (usec): min=260 , max=1621.8K, avg=54073.49, stdev=246588.56
clat percentiles (usec):
| 1.00th=[ 310], 5.00th=[ 4448], 10.00th=[ 5344], 20.00th=[ 5408],
| 30.00th=[ 5408], 40.00th=[ 5408], 50.00th=[ 5408], 60.00th=[ 5472],
| 70.00th=[ 5472], 80.00th=[ 5600], 90.00th=[ 6432], 95.00th=[ 6624],
| 99.00th=[1433600], 99.50th=[1515520], 99.90th=[1597440], 99.95th=[1613824],
| 99.99th=[1613824]
bw (KB/s) : min= 320, max=92444, per=10.64%, avg=10063.43, stdev=11980.51
lat (usec) : 250=0.01%, 500=2.46%, 750=0.23%, 1000=0.06%
lat (msec) : 2=0.10%, 4=1.46%, 10=91.63%, 20=0.04%, 50=0.03%
lat (msec) : 100=0.09%, 250=0.01%, 500=0.01%, 750=0.09%, 1000=0.57%
lat (msec) : 2000=3.19%
cpu : usr=0.42%, sys=1.35%, ctx=181036, majf=0, minf=6857
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=0/w=6981/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
WRITE: io=3490.6MB, aggrb=94615KB/s, minb=94615KB/s, maxb=94615KB/s, mint=37777msec, maxt=37777msec

Disk stats (read/write):
vdb: ios=0/6986, merge=0/7, ticks=0/38692, in_queue=38688, util=98.45%