Storage Performance Development Kit (SPDK)提供了一组用于编写高性能、可伸缩、用户态存储应用程序的工具和库。
一. 安装 FIO
下载 FIO 源码到 fio_dir 目录下, git clone https://github.com/axboe/fio
, fio_dir 在这里只是举例,可以是其他目录.
1 | cd fio && git checkout fio-3.3 |
推荐使用 fio-3.3,最后也可以不 make install
二. 安装 SPDK
下载 spdk 到 spdk_dir 目录下(spdk_dir 在这里只是举例,可以是其他目录)。
1 | git clone https://github.com/spdk/spdk |
修改 spdk/CONFIG
文件中的 CONFIG_FIO_PLUGIN=
为 FIO 的路径。
编译:
1 | cd spdk |
--with-fio=
后面添加 fio 的目录。configure 后面可以再加其他配置,比如 --with-shared
会编译生成总的 libspdk.so
链接库,否则只会生成许多单个的链接库。make install
会把 spdk 安装到某个路径。比如 /usr/local/lib 之类的。可以自行查看,必须确保该路径在动态链接库的默认搜索路径中。可以自己设置链接库的搜索路径。
三. 利用 FIO 测试 SPDK
修改测试用例 spdk/examples/nvme/fio_plugin/fio_plugin/example_config.fio
, 添加 filename
, 如
filename=trtype=PCIe traddr=0000.04.00.0 ns=1
或者 filename=trtype=RDMA adrfam=IPv4 traddr=192.168.100.8 trsvcid=4420 ns=1
traddr=0000.04.00.0
的地址可以通过 lspci | grep SSD
查看
测试:
1 | LD_PRELOAD=spdk_dir/spdk/examples/nvme/fio_plugin/fio_plugin fio_dir/fio/fio example_config.fio |
https://github.com/spdk/spdk/tree/master/examples/nvme/fio_plugin
https://github.com/spdk/spdk/issues/367