brew install fio
顺序读
fio --filename=/Volumes/m2/2m-seq-read --direct=1 --rw=read --ioengine=posixaio --bs=2m --iodepth=64 --size=10G --numjobs=1 --runtime=60 --time_base=1 --group_reporting --name=test-seq-read
╰─➤ fio --filename=/Volumes/m2/2m-seq-read --direct=1 --rw=read --ioengine=posixaio --bs=2m --iodepth=64 --size=10G --numjobs=1 --runtime=60 --time_base=1 --group_reporting --name=test-seq-read
test-seq-read: (g=0): rw=read, bs=(R) 2048KiB-2048KiB, (W) 2048KiB-2048KiB, (T) 2048KiB-2048KiB, ioengine=posixaio, iodepth=64
fio-3.30
Starting 1 process
test-seq-read: Laying out IO file (1 file / 10240MiB)
Jobs: 1 (f=1): [R(1)][100.0%][r=762MiB/s][r=380 IOPS][eta 00m:00s]
test-seq-read: (groupid=0, jobs=1): err= 0: pid=76333: Sun May 22 10:44:43 2022
read: IOPS=412, BW=825MiB/s (865MB/s)(48.4GiB/60042msec)
slat (nsec): min=0, max=1193.0k, avg=2872.83, stdev=11818.36
clat (usec): min=1374, max=58963k, avg=38784.34, stdev=380400.29
lat (usec): min=1378, max=58963k, avg=38787.21, stdev=380400.27
clat percentiles (msec):
| 1.00th=[ 3], 5.00th=[ 22], 10.00th=[ 28], 20.00th=[ 30],
| 30.00th=[ 32], 40.00th=[ 33], 50.00th=[ 34], 60.00th=[ 34],
| 70.00th=[ 35], 80.00th=[ 37], 90.00th=[ 41], 95.00th=[ 47],
| 99.00th=[ 121], 99.50th=[ 169], 99.90th=[ 634], 99.95th=[ 1452],
| 99.99th=[ 3742]
bw ( KiB/s): min=738422, max=1709386, per=100.00%, avg=845435.55, stdev=159825.37, samples=119
iops : min= 360, max= 834, avg=412.37, stdev=78.05, samples=119
lat (msec) : 2=0.09%, 4=1.81%, 10=1.60%, 20=0.94%, 50=91.35%
lat (msec) : 100=2.82%, 250=1.19%, 500=0.08%, 750=0.03%, 1000=0.02%
lat (msec) : 2000=0.03%, >=2000=0.04%
cpu : usr=0.49%, sys=0.66%, ctx=26234, majf=0, minf=7
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=43.8%, 16=56.1%, 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=99.0%, 8=1.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=24762,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=64
Run status group 0 (all jobs):
READ: bw=825MiB/s (865MB/s), 825MiB/s-825MiB/s (865MB/s-865MB/s), io=48.4GiB (51.9GB), run=60042-60042msec
顺序写
fio --filename=/Volumes/m2/2m-seq-write --direct=1 --rw=write --ioengine=posixaio --bs=2m --iodepth=64 --size=10G --numjobs=1 --runtime=60 --time_base=1 --group_reporting --name=test-seq-write
╰─➤ fio --filename=/Volumes/m2/2m-seq-write --direct=1 --rw=write --ioengine=posixaio --bs=2m --iodepth=64 --size=10G --numjobs=1 --runtime=60 --time_base=1 --group_reporting --name=test-seq-write
test-seq-write: (g=0): rw=write, bs=(R) 2048KiB-2048KiB, (W) 2048KiB-2048KiB, (T) 2048KiB-2048KiB, ioengine=posixaio, iodepth=64
fio-3.30
Starting 1 process
test-seq-write: Laying out IO file (1 file / 10240MiB)
Jobs: 1 (f=1): [W(1)][100.0%][w=804MiB/s][w=402 IOPS][eta 00m:00s]
test-seq-write: (groupid=0, jobs=1): err= 0: pid=77487: Sun May 22 10:47:31 2022
write: IOPS=368, BW=736MiB/s (772MB/s)(43.2GiB/60039msec); 0 zone resets
slat (nsec): min=0, max=5735.0k, avg=147808.44, stdev=207256.33
clat (msec): min=16, max=54344, avg=43.19, stdev=366.70
lat (msec): min=16, max=54344, avg=43.34, stdev=366.70
clat percentiles (msec):
| 1.00th=[ 27], 5.00th=[ 31], 10.00th=[ 33], 20.00th=[ 35],
| 30.00th=[ 37], 40.00th=[ 39], 50.00th=[ 40], 60.00th=[ 41],
| 70.00th=[ 42], 80.00th=[ 46], 90.00th=[ 52], 95.00th=[ 57],
| 99.00th=[ 68], 99.50th=[ 73], 99.90th=[ 84], 99.95th=[ 92],
| 99.99th=[ 1167]
bw ( KiB/s): min=576383, max=841142, per=100.00%, avg=754688.71, stdev=86301.30, samples=119
iops : min= 281, max= 410, avg=368.01, stdev=42.20, samples=119
lat (msec) : 20=0.06%, 50=88.43%, 100=11.48%, 250=0.02%, 2000=0.01%
lat (msec) : >=2000=0.01%
cpu : usr=6.06%, sys=5.25%, ctx=48866, majf=0, minf=8
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=44.0%, 16=55.9%, 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=99.2%, 8=0.8%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=0,22108,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=64
Run status group 0 (all jobs):
WRITE: bw=736MiB/s (772MB/s), 736MiB/s-736MiB/s (772MB/s-772MB/s), io=43.2GiB (46.4GB), run=60039-60039msec
随机读
fio --filename=/Volumes/m2/4k-randread --randrepeat=1 --ioengine=posixaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randread
fio --filename=/Volumes/m2/4k-readwrite --randrepeat=1 --ioengine=posixaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randread
test: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=posixaio, iodepth=64
fio-3.30
Starting 1 process
test: Laying out IO files (2 files / total 4096MiB)
Jobs: 1 (f=2): [r(1)][100.0%][r=58.5MiB/s][r=15.0k IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=81099: Sun May 22 10:56:37 2022
read: IOPS=15.2k, BW=59.3MiB/s (62.2MB/s)(4096MiB/69104msec)
bw ( KiB/s): min=54886, max=65219, per=100.00%, avg=60739.01, stdev=2291.05, samples=137
iops : min=13721, max=16304, avg=15184.39, stdev=572.76, samples=137
cpu : usr=3.87%, sys=4.24%, ctx=980173, majf=0, minf=4
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=47.0%, 16=53.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=99.3%, 8=0.7%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=1048576,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=64
Run status group 0 (all jobs):
READ: bw=59.3MiB/s (62.2MB/s), 59.3MiB/s-59.3MiB/s (62.2MB/s-62.2MB/s), io=4096MiB (4295MB), run=69104-69104msec
随机写
fio --filename=/Volumes/m2/4k-randwrite --randrepeat=1 --ioengine=posixaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randwrite
╰─➤ fio --filename=/Volumes/m2/4k-randwrite --randrepeat=1 --ioengine=posixaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randwrite
test: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=posixaio, iodepth=64
fio-3.30
Starting 1 process
test: Laying out IO file (1 file / 2048MiB)
Jobs: 1 (f=2): [w(1)][100.0%][w=30.4MiB/s][w=7787 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=83213: Sun May 22 11:02:37 2022
write: IOPS=8992, BW=35.1MiB/s (36.8MB/s)(4096MiB/116604msec); 0 zone resets
bw ( KiB/s): min= 87, max=38376, per=100.00%, avg=36471.48, stdev=3677.40, samples=228
iops : min= 21, max= 9594, avg=9117.58, stdev=919.40, samples=228
cpu : usr=2.39%, sys=2.58%, ctx=1104653, majf=0, minf=4
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=47.0%, 16=53.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=99.0%, 8=1.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=0,1048576,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=64
Run status group 0 (all jobs):
WRITE: bw=35.1MiB/s (36.8MB/s), 35.1MiB/s-35.1MiB/s (36.8MB/s-36.8MB/s), io=4096MiB (4295MB), run=116604-116604msec
参考
- MEASURING DISK IO PERFORMANCE ON MACOS