我试图使用 fio 工具和 ioengine 作为 libaio 来获取性能数据(简单的 4K 随机读取)。我观察到,如果直接 io 被禁用(direct=0),那么 iops 会急剧下降。当提供 direct=1 时,IOPS 提高了 50 倍!
setup: fio being run from a linux client connected to a PCIe based
appliance over Fibre Channel.
Run Code Online (Sandbox Code Playgroud)
这是我的 fio 配置文件中的片段:
[global]
filename=/dev/dm-30
size=10G
runtime=300
time_based
group_reporting
[test]
rw=randread
bs=4k
iodepth=16
runtime=300
ioengine=libaio
refill_buffers
ioscheduler=noop
#direct=1
Run Code Online (Sandbox Code Playgroud)
通过此设置,我观察到 iops 约为 8000,当我在上面显示的配置文件中启用 direct=1 时,我看到 iops 跃升至 250K!(对于我正在使用的设置来说这是现实的)
所以,我的问题是如果我们使用 libaio 引擎,使用缓冲 I/O 有什么问题吗?如果我们使用libaio,我们是否必须坚持直接io?