本文主要是介绍在虚拟机上部署SPDK NVME测试案例,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
作者简介:
万群
Intel 存储软件工程师
主要从事SPDK软件测试工作
_1 背景介绍_
_2 配置虚拟机环境_
在BIOS里面确保VT选项是打开的,安装VirtualBox5.1.38 或者更新版本(建议使用5.1.38版本)
搜索“Windows features”并关闭Hyper-V选项,重启windows 操作系统,安装VirtualBox ExtensionPack(https://www.virtualbox.org/wiki/Downloads)5.1.38版本或者更新版本(同样建议使用5.1.38版本)
2.安装Vagrant(https://www.vagrantup.com/)1.9.4版本或者更新版本(建议使用1.9.4版本)
a.如果有防火墙,建议使用代理来提高下载速度
$export https_proxy= $export http_proxy= |
$vagrant plugin install vagrant-proxyconf |
b.下载SPDK代码,命令行如下
$git clone https://github.com/spdk/spdk.git |
c.编译并创建虚拟机,命令行如下
$cd spdk/ $git submodule update –init $./spdk/scripts/vagrant/create_vbox.sh –n 4 –s 4096 fedora28 (-n指定虚拟机CPU数量,-s指定虚拟机内存大小,执行这一步如遇到下面的问题,则很有可能是网络不够稳定或者网速太慢,可以选择一个网速比较稳定或者快的时间重新下载) |
d.登录虚拟机,命令如下
$cd fedora28-virtualbox $vagrant ssh |
e.验证虚拟NVMe设备是否存在,命令行如下
$lspci | grep “Non-Volatile” 00:0e.0 Non-Volatile memory controller: InnoTek Systemberatung GmbH Device 4e56 |
f.同样,在虚拟机里面,也需要对代理进行设置,然后编译SPDK代码,命令行如下:
$apt-get update $cd ~/spdk_repo/spdk $git submodule update –init (如果无法成功执行上面的命令,可以尝试重新下载SPDK代码,命令为 $git clone https://github.com/spdk/spdk.git ) $scripts/pkgdep.sh (如果出现警告可以使用如下命令进行清除 $git reset --hard) $make |
g.通过运行hello_word实例来验证SPDK安装成功
$script/setup.sh $cd examples/bdev/hello_world/ $./hello_bdev –c bdev.conf |

$cd /home/vagrant/spdk_repo/spdk $./scripts/setup.sh 0000:00:0e.0 (80ee 4e56): nvme -> uio_pci_generic |
$ ./examples/nvme/hello_world/hello_world Starting SPDK v19.10-pre / DPDK 19.05.0 initialization... [ DPDK EAL parameters: hello_world -c 0x1 --log-level=lib.eal:6 --log-level=lib.cryptodev:5 --log-level=user1:6 --base-virtaddr=0x200000000000 --match-allocations --file-prefix=spdk0 --proc-type=auto ] Initializing NVMe Controllers Attaching to 0000:00:0e.0 Attached to 0000:00:0e.0 Using controller ORCL-VBOX-NVME-VER12 (VB1234-56789 ) with 1 namespaces. Namespace ID: 1 size: 1GB Initialization complete. INFO: using host memory buffer for IO Hello world! |
$./examples/nvme/perf/perf -q 128 -o 4096 -w randread -r 'trtype:PCIe traddr:0000:00:0e.0' -t 10 Starting SPDK v19.10-pre / DPDK 19.05.0 initialization... [ DPDK EAL parameters: perf --no-shconf -c 0x1 --log-level=lib.eal:6 --log-level=lib.cryptodev:5 --log-level=user1:6 --base-virtaddr=0x200000000000 --match-allocations --file-prefix=spdk_pid7543 ] Initializing NVMe Controllers Attaching to NVMe Controller at 0000:00:0e.0 Attached to NVMe Controller at 0000:00:0e.0 [80ee:4e56] Associating PCIE (0000:00:0e.0) with lcore 0 Initialization complete. Launching workers. Starting thread on core 0 ======================================================== Latency(us) Device Information : IOPS MiB/s Average min max PCIE (0000:00:0e.0) from core 0: 6257.30 24.44 20476.55 2274.99 31814.34 ======================================================== Total : 6257.30 24.44 20476.55 2274.99 31814.34 |
$./examples/nvme/nvme_manage/nvme_manage Starting SPDK v19.10-pre / DPDK 19.05.0 initialization... [ DPDK EAL parameters: nvme_manage --no-shconf -c 0x1 --log-level=lib.eal:6 --log-level=lib.cryptodev:5 --log-level=user1:6 --base-virtaddr=0x200000000000 --match-allocations --file-prefix=spdk_pid7547 ] NVMe Management Options [1: list controllers] [2: create namespace] [3: delete namespace] [4: attach namespace to controller] [5: detach namespace from controller] [6: format namespace or controller] [7: firmware update] [8: opal] [9: quit] |
$ ./examples/nvme/identify/identify Starting SPDK v19.10-pre / DPDK 19.05.0 initialization... [ DPDK EAL parameters: identify --no-shconf -c 0x1 -n 1 -m 0 --log-level=lib.eal:6 --log-level=lib.cryptodev:5 --log-level=user1:6 --base-virtaddr=0x200000000000 --match-allocations --file-prefix=spdk_pid7554 ] ===================================================== NVMe Controller at 0000:00:0e.0 [80ee:4e56] ===================================================== Controller Capabilities/Features ================================ Vendor ID: 80ee Subsystem Vendor ID: 80ee Serial Number: VB1234-56789 Model Number: ORCL-VBOX-NVME-VER12 Firmware Version: 1.0 Recommended Arb Burst: 0 IEEE OUI Identifier: 00 00 00 Multi-path I/O May have multiple subsystem ports: No May be connected to multiple hosts: No Associated with SR-IOV VF: No Max Data Transfer Size: Unlimited Error Recovery Timeout: Unlimited NVMe Specification Version (VS): 1.2 NVMe Specification Version (Identify): 1.2 Maximum Queue Entries: 4096 Contiguous Queues Required: Yes Arbitration Mechanisms Supported Weighted Round Robin: Not Supported Vendor Specific: Not Supported Reset Timeout: 5000 ms Doorbell Stride: 4 bytes NVM Subsystem Reset: Not Supported Command Sets Supported NVM Command Set: Supported Boot Partition: Not Supported Memory Page Size Minimum: 4096 bytes Memory Page Size Maximum: 4096 bytes Optional Asynchronous Events Supported Namespace Attribute Notices: Not Supported Firmware Activation Notices: Not Supported 128-bit Host Identifier: Not Supported … 限于篇幅,后续的打印日志省略 |
在test目录运行nvme测试案例
$ ./test/nvme/aer/aer -r 'trtype:PCIe traddr:0000:00:0e.0' Starting SPDK v19.10-pre / DPDK 19.05.0 initialization... [ DPDK EAL parameters: aer --no-shconf -c 0x1 --log-level=lib.eal:6 --log-level=lib.cryptodev:5 --log-level=user1:6 --base-virtaddr=0x200000000000 --match-allocations --file-prefix=spdk_pid7715 ] Asynchronous Event Request test Attaching to 0000:00:0e.0 Attached to 0000:00:0e.0 Registering asynchronous event callbacks... Cleaning up... |
$ ./test/nvme/e2edp/nvme_dp Starting SPDK v19.10-pre / DPDK 19.05.0 initialization... [ DPDK EAL parameters: nvme_dp -c 0x1 --log-level=lib.eal:6 --log-level=lib.cryptodev:5 --log-level=user1:6 --base-virtaddr=0x200000000000 --match-allocations --file-prefix=spdk0 --proc-type=auto ] NVMe Write/Read with End-to-End data protection test Attaching to 0000:00:0e.0 Attached to 0000:00:0e.0 Cleaning up... |
$ ./test/nvme/perf/run_perf.sh --numjobs=1 --iodepth=128 --rw=randread --fio-bin=/usr/src/fio/fio --ramp-time=10 --run-time=10 ++++ dirname ./test/nvme/perf/run_perf.sh +++ readlink -f ./test/nvme/perf ++ BASE_DIR=/home/vagrant/spdk/test/nvme/perf +++ readlink -f /home/vagrant/spdk/test/nvme/perf/../../.. ++ ROOT_DIR=/home/vagrant/spdk ++ PLUGIN_DIR_NVME=/home/vagrant/spdk/examples/nvme/fio_plugin ++ PLUGIN_DIR_BDEV=/home/vagrant/spdk/examples/bdev/fio_plugin ++ BDEVPERF_DIR=/home/vagrant/spdk/test/bdev/bdevperf ++ . /home/vagrant/spdk/scripts/common.sh ++ . /home/vagrant/spdk/test/common/autotest_common.sh +++ xtrace_disable +++ PREV_BASH_OPTS=ehxB +++ set +x 01:27:46 # xtrace_enable 01:27:46 # NVME_FIO_RESULTS=/home/vagrant/spdk/test/nvme/perf/result.json 01:27:46 # PRECONDITIONING=true 01:27:46 # FIO_BIN=/usr/src/fio/fio 01:27:46 # RUNTIME=600 01:27:46 # PLUGIN=nvme 01:27:46 # RAMP_TIME=30 01:27:46 # BLK_SIZE=4096 01:27:46 # RW=randrw 01:27:46 # MIX=100 01:27:46 # IODEPTH=256 01:27:46 # DISKNO=1 01:27:46 # ONEWORKLOAD=false 01:27:46 # CPUS_ALLOWED=1 01:27:46 # NUMJOBS=1 01:27:46 # REPEAT_NO=3 01:27:46 # NOIOSCALING=false 01:27:46 # getopts h-: optchar 01:27:46 # case "$optchar" in 01:27:46 # case "$OPTARG" in 01:27:46 # NUMJOBS=1 … 限于篇幅,这里只列出前面几行的打印日志 最后的测试性能数据保存在下列文件中 : /home/vagrant/spdk/test/nvme/perf/results/perf_results_4096BS_128QD_randread_100MIX_nvme_08_05_2019_012746/perf_results_4096BS_128QD_randread_100MIX_nvme_08_05_2019_012746.csv |
## ERROR: requested 4096 hugepages but only 1719 could be allocated. ## Memory might be heavily fragmented. Please try flushing the system cache, or reboot the machine. 0000:00:0e.0 (80ee 4e56): uio_pci_generic -> nvme Clean |
参考文献
Thanks for watching!
END
转载须知
SPDK NVMe Reservation使用简介

这篇关于在虚拟机上部署SPDK NVME测试案例的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!