本页详细介绍了如何验证卷性能。
使用 Fio 衡量音量性能
使用 I/O 生成器工具 Fio 衡量基准性能。
使用 Fio
Fio 会应用您通过命令行界面或配置文件指定的工作负载。运行期间,Fio 会显示一个进度指示器,其中包含当前吞吐量以及每秒输入和输出操作数 (IOPS) 数值。完成后,系统会显示详细摘要。
Fio 结果示例
以下示例展示了运行 60 秒的单线程 4k 随机写入作业,这是一种衡量基准延迟时间的实用方法。在以下命令中,--directory
参数指向包含已装载 NetApp Volumes 共享的文件夹:
$ FIO_COMMON_ARGS=--size=10g --fallocate=none --direct=1 --runtime=60 --time_based --ramp_time=5
$ fio $FIO_COMMON_ARGS --directory=/netapp --ioengine=libaio --rw=randwrite --bs=4k --iodepth=1 --name=nv
cvs: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=1
fio-3.28
Starting 1 process
cvs: Laying out IO file (1 file / 10240MiB)
Jobs: 1 (f=1): [w(1)][100.0%][w=7856KiB/s][w=1964 IOPS][eta 00m:00s]
cvs: (groupid=0, jobs=1): err= 0: pid=1891: Wed Dec 21 14:56:37 2022
write: IOPS=1999, BW=7999KiB/s (8191kB/s)(469MiB/60001msec); 0 zone resets
slat (usec): min=4, max=417, avg=12.06, stdev= 5.71
clat (usec): min=366, max=27978, avg=483.59, stdev=91.34
lat (usec): min=382, max=28001, avg=495.96, stdev=91.89
clat percentiles (usec):
| 1.00th=[ 408], 5.00th=[ 429], 10.00th=[ 437], 20.00th=[ 449],
| 30.00th=[ 461], 40.00th=[ 469], 50.00th=[ 482], 60.00th=[ 490],
| 70.00th=[ 498], 80.00th=[ 515], 90.00th=[ 529], 95.00th=[ 553],
| 99.00th=[ 611], 99.50th=[ 652], 99.90th=[ 807], 99.95th=[ 873],
| 99.99th=[ 1020]
bw ( KiB/s): min= 7408, max= 8336, per=100.00%, avg=8002.05, stdev=140.09, samples=120
iops : min= 1852, max= 2084, avg=2000.45, stdev=35.06, samples=120
lat (usec) : 500=70.67%, 750=29.17%, 1000=0.15%
lat (msec) : 2=0.01%, 4=0.01%, 50=0.01%
cpu : usr=2.04%, sys=3.25%, ctx=120561, majf=0, minf=58
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 rwts: total=0,119984,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
WRITE: bw=7999KiB/s (8191kB/s), 7999KiB/s-7999KiB/s (8191kB/s-8191kB/s), io=469MiB (491MB), run=60001-60001msec
请阅读以下行,详细了解效果结果:
延迟时间:
lat (usec): min=382, max=28001, avg=495.96, stdev=91.89
平均延迟时间为 495.96 微秒 (usec),大约为 0.5 毫秒,这是理想的延迟时间。
IOPS:
min= 1852, max= 2084, avg=2000.45, stdev=35.06, samples=120
上例显示平均 IOPS 为 2,000。对于延迟时间为 0.5 毫秒的单线程作业,预计该值为
IOPS = 1000 ms/0.5 ms = 2000
。吞吐量:
bw ( KiB/s): min= 7408, max=8336, per=100.00%, avg=8002.05, stdev=140.09
平均吞吐量为 8002 KiBps,这是块大小为 4 KiB (
2000 1/s * 4 KiB = 8,000 KiB/s
) 且 IOPS 为 2,000 的预期结果。
测量延迟时间
延迟时间是衡量大量数据传输性能的基本指标。这是由客户端和服务器功能、客户端和服务器之间的距离(音量)以及中间的设备决定的。该指标的主要组成部分是距离导致的延迟时间。
您可以对卷的 IP 地址执行 ping 操作,以获取往返时间,这是一个大致的延迟时间估算值。
延迟时间受块大小以及您执行的是读取操作还是写入操作的影响。我们建议您使用以下参数来衡量客户端与数据卷之间的基准延迟时间:
Linux
fio --directory=/netapp \ --ioengine=libaio \ --rw=randwrite \ --bs=4k --iodepth=1 \ --size=10g \ --fallocate=none \ --direct=1 \ --runtime=60 \ --time_based \ --ramp_time=5 \ --name=latency
Windows
fio --directory=Z\:\ --ioengine=windowsaio --thread --rw=randwrite --bs=4k --iodepth=1 --size=10g --fallocate=none --direct=1 --runtime=60 --time_based --ramp_time=5 --name=latency
替换参数 rw
(read/write/randread/randwrite)和 bs
(块大小),以适应您的工作负载。块大小越大,延迟时间就越长,其中读取速度比写入速度快。结果可在 lat
行中找到。
衡量 IOPS
IOPS 是延迟时间和并发性的直接结果。根据您的客户端类型,使用以下任一标签页来衡量 IOPS:
Linux
fio --directory=/netapp \ --ioengine=libaio \ --rw=randread \ --bs=4k \ --iodepth=32 \ --size=10g \ --fallocate=none \ --direct=1 \ --runtime=60 \ --time_based \ --ramp_time=5 \ --name=iops
Windows
fio --directory=Z\:\ --ioengine=windowsaio --thread --rw=randread --bs=4k --iodepth=32 --size=10g --fallocate=none --direct=1 --runtime=60 --time_based --ramp_time=5 --numjobs=16 --name=iops
替换参数 rw
(read/write/randread/randwrite)、bs
(blocksize)和 iodepth
(并发),以适应您的工作负载。结果可以在 iops
行中找到。
衡量吞吐量
吞吐量等于 IOPS 乘以块大小。根据您的客户端类型,使用以下任一标签页来衡量吞吐量:
Linux
fio --directory=/netapp \ --ioengine=libaio \ --rw=read \ --bs=64k \ --iodepth=32 \ --size=10g \ --fallocate=none \ --direct=1 \ --runtime=60 \ --time_based \ --ramp_time=5 \ --numjobs=16 \ --name=throughput
Windows
fio --directory=Z\:\ --ioengine=windowsaio --thread --rw=read --bs=64k --iodepth=32 --size=10g --fallocate=none --direct=1 --runtime=60 --time_based --ramp_time=5 --numjobs=16 --name=throughput
替换参数 rw
(read/write/randread/randwrite)、bs
(blocksize)和 iodepth
(并发),以适应您的工作负载。您只能使用 64k 或更大的块大小和高并发性来实现高吞吐量。
后续步骤
查看性能基准。