在虚拟机上部署SPDK NVME测试案例

3 篇文章 0 订阅
2 篇文章 1 订阅

准备spdk环境

详见:浅谈SPDK(二.1)虚拟机搭建SPDK环境–简话版

build目录

我们编译spdk后

./configure
make

,会在build文件下生成如下文件

vagrant@vagrant:~/spdk/build$ ll
total 28
drwxrwxr-x  7 vagrant vagrant 4096 Aug 31 09:28 ./
drwxrwxr-x 28 vagrant vagrant 4096 Aug 31 07:57 ../
drwxr-xr-x  2 root    root    4096 Aug 31 09:29 bin/ 
drwxr-xr-x  2 root    root    4096 Aug 31 09:29 examples/ #存放案例,有helloword、perf、identify等等可执行文件
drwxr-xr-x  2 root    root    4096 Aug 31 09:28 fio/ #含有spdk_bdev和spdk_nvme
drwxr-xr-x  3 root    root    4096 Aug 31 09:28 include/
drwxrwxr-x  3 vagrant vagrant 4096 Aug 31 09:29 lib/

SPDK提供两种形态的fio_plugin:

  • 基于裸盘NVMe的fio_plugin(spdk_nvme),其特点为I/O通过SPDK用户态驱动直接访问裸盘,常用于评估SPDK用户态驱动在裸盘上的性能。
  • 基于bdev的fio_plugin(spdk_bdev),其特点为I/O测试基于SPDK块设备bdev之上,所有I/O经由块设备层bdev,再传送至裸盘设备。常用于评估SPDK块设备bdev的性能。

在examples目录下运行NVMe的案例

1、在examples目录下运行NVMe的hello_world测试案例来确保环境已经能够正常使用虚拟的nvme设备

vagrant@vagrant:~/spdk/build$ sudo ./examples/hello_world
[2021-08-31 10:42:31.257911] Starting SPDK v21.04.1-pre git sha1 7dc38f83f / DPDK 20.11.0 initialization...
[2021-08-31 10:42:31.257986] [ DPDK EAL parameters: [2021-08-31 10:42:31.257999] hello_world [2021-08-31 10:42:31.258005] -c 0x1 [2021-08-31 10:42:31.258012] --log-level=lib.eal:6 [2021-08-31 10:42:31.258016] --log-level=lib.cryptodev:5 [2021-08-31 10:42:31.258023] --log-level=user1:6 [2021-08-31 10:42:31.258026] --iova-mode=pa [2021-08-31 10:42:31.258033] --base-virtaddr=0x200000000000 [2021-08-31 10:42:31.258045] --match-allocations [2021-08-31 10:42:31.258051] --file-prefix=spdk0 [2021-08-31 10:42:31.258055] --proc-type=auto [2021-08-31 10:42:31.258059] ]
EAL: No legacy callbacks, legacy socket not created
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.
[2021-08-31 10:42:31.370662] nvme_pcie.c: 462:nvme_pcie_ctrlr_map_io_cmb: *ERROR*: CMB is already in use for submission queues.
INFO: using host memory buffer for IO
Hello world!

2、在examples目录下运行NVMe的perf测试案例测试各种IO的性能

vagrant@vagrant:~/spdk/build$ sudo /home/vagrant/spdk/build/examples/perf -q 128 -o 4096 -w randread -r 'trtype:PCIe traddr:00:0e.0' -t 10
[2021-08-31 10:43:06.591688] Starting SPDK v21.04.1-pre git sha1 7dc38f83f / DPDK 20.11.0 initialization...
[2021-08-31 10:43:06.591760] [ DPDK EAL parameters: [2021-08-31 10:43:06.591769] perf [2021-08-31 10:43:06.591775] --no-shconf [2021-08-31 10:43:06.591782] -c 0x1 [2021-08-31 10:43:06.591786] --log-level=lib.eal:6 [2021-08-31 10:43:06.591792] --log-level=lib.cryptodev:5 [2021-08-31 10:43:06.591800] --log-level=user1:6 [2021-08-31 10:43:06.591804] --iova-mode=pa [2021-08-31 10:43:06.591808] --base-virtaddr=0x200000000000 [2021-08-31 10:43:06.591812] --match-allocations [2021-08-31 10:43:06.591815] --file-prefix=spdk_pid29908 [2021-08-31 10:43:06.591819] ]
EAL: No legacy callbacks, legacy socket not created
Initializing NVMe Controllers
Attached to NVMe Controller at 0000:00:0e.0 [80ee:4e56]
Associating PCIE (0000:00:0e.0) NSID 1 with lcore 0
Initialization complete. Launching workers.
========================================================
                                                                           Latency(us)
Device Information                     :       IOPS      MiB/s    Average        min        max
PCIE (0000:00:0e.0) NSID 1 from core  0:   79225.90     309.48    1615.63     182.54   25222.40
========================================================
Total                                  :   79225.90     309.48    1615.63     182.54   25222.40

3、在examples目录下运行NVMe的nvme_manage测试案例,这里nvme_manage可用来查看controller的信息,创建namespace以及更新firmware等,具体可以通过选择相应数字选项来操作

vagrant@vagrant:~/spdk/build$ sudo /home/vagrant/spdk/build/examples/nvme_manage 
[2021-08-31 10:44:04.254280] Starting SPDK v21.04.1-pre git sha1 7dc38f83f / DPDK 20.11.0 initialization...
[2021-08-31 10:44:04.254364] [ DPDK EAL parameters: [2021-08-31 10:44:04.254370] nvme_manage [2021-08-31 10:44:04.254381] --no-shconf [2021-08-31 10:44:04.254387] -c 0x1 [2021-08-31 10:44:04.254391] --log-level=lib.eal:6 [2021-08-31 10:44:04.254395] --log-level=lib.cryptodev:5 [2021-08-31 10:44:04.254399] --log-level=user1:6 [2021-08-31 10:44:04.254403] --iova-mode=pa [2021-08-31 10:44:04.254413] --base-virtaddr=0x200000000000 [2021-08-31 10:44:04.254420] --match-allocations [2021-08-31 10:44:04.254426] --file-prefix=spdk_pid29914 [2021-08-31 10:44:04.254429] ]
EAL: No legacy callbacks, legacy socket not created
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]

5、在examples目录下运行NVMe的identify测试案例,用于查看SSD的vendorID,firmware以及型号等信息

vagrant@vagrant:~/spdk/build$ sudo /home/vagrant/spdk/build/examples/identify
[2021-08-31 10:45:29.491650] Starting SPDK v21.04.1-pre git sha1 7dc38f83f / DPDK 20.11.0 initialization...
[2021-08-31 10:45:29.491732] [ DPDK EAL parameters: [2021-08-31 10:45:29.491743] identify [2021-08-31 10:45:29.491748] --no-shconf [2021-08-31 10:45:29.491751] -c 0x1 [2021-08-31 10:45:29.491755] -n 1 [2021-08-31 10:45:29.491758] -m 0 [2021-08-31 10:45:29.491762] --log-level=lib.eal:6 [2021-08-31 10:45:29.491766] --log-level=lib.cryptodev:5 [2021-08-31 10:45:29.491769] --log-level=user1:6 [2021-08-31 10:45:29.491773] --iova-mode=pa [2021-08-31 10:45:29.491777] --base-virtaddr=0x200000000000 [2021-08-31 10:45:29.491781] --match-allocations [2021-08-31 10:45:29.491786] --file-prefix=spdk_pid29921 [2021-08-31 10:45:29.491789] ]
EAL: No legacy callbacks, legacy socket not created
=====================================================
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
Max Number of Namespaces:              1
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
Persistent Memory Region:              Not Supported
Optional Asynchronous Events Supported
  Namespace Attribute Notices:         Not Supported
  Firmware Activation Notices:         Not Supported
128-bit Host Identifier:               Not Supported

Controller Memory Buffer Support
================================
Supported:                             Yes
Total Size:                            5242880 bytes
Submission Queues in CMB:              Supported
Completion Queues in CMB:              Supported
Read data and metadata in CMB          Not Supported
Write data and metadata in CMB:        Not Supported

Persistent Memory Region Support
================================
Supported:                             No

Admin Command Set Attributes
============================
Security Send/Receive:                 Not Supported
Format NVM:                            Not Supported
Firmware Activate/Download:            Not Supported
Namespace Management:                  Not Supported
Device Self-Test:                      Not Supported
Directives:                            Not Supported
NVMe-MI:                               Not Supported
Virtualization Management:             Not Supported
Doorbell Buffer Config:                Not Supported
Abort Command Limit:                   5
Async Event Request Limit:             5
Number of Firmware Slots:              N/A
Firmware Slot 1 Read-Only:             N/A
Firmware Update Granularity:           No Information Provided
Per-Namespace SMART Log:               No
Asymmetric Namespace Access Log Page:  Not Supported
Command Effects Log Page:              Not Supported
Get Log Page Extended Data:            Not Supported
Telemetry Log Pages:                   Not Supported
Error Log Page Entries Supported:      1
Keep Alive:                            Not Supported

NVM Command Set Attributes
==========================
Submission Queue Entry Size
  Max:                       64
  Min:                       64
Completion Queue Entry Size
  Max:                       16
  Min:                       16
Number of Namespaces:        1
Compare Command:             Not Supported
Write Uncorrectable Command: Not Supported
Dataset Management Command:  Not Supported
Write Zeroes Command:        Not Supported
Set Features Save Field:     Not Supported
Reservations:                Not Supported
Timestamp:                   Not Supported
Volatile Write Cache:        Not Present
Atomic Write Unit (Normal):  1
Atomic Write Unit (PFail):   1
Atomic Compare & Write Unit: 1
Fused Compare & Write:       Not Supported
Scatter-Gather List
  SGL Command Set:           Not Supported
  SGL Keyed:                 Not Supported
  SGL Bit Bucket Descriptor: Not Supported
  SGL Metadata Pointer:      Not Supported
  Oversized SGL:             Not Supported
  SGL Metadata Address:      Not Supported
  SGL Offset:                Not Supported
  Transport SGL Data Block:  Not Supported
Replay Protected Memory Block:  Not Supported

Firmware Slot Information
=========================
Active slot:                 0


Error Log
=========

Arbitration
===========
Arbitration Burst:           1

Power Management
================
Number of Power States:      1
Current Power State:         Power State #0
Power State #0:  Max Power:   0.01 W
Non-Operational Permissive Mode: Not Supported

Health Information
==================
Critical Warnings:
  Available Spare Space:     OK
  Temperature:               OK
  Device Reliability:        OK
  Read Only:                 No
  Volatile Memory Backup:    OK
Current Temperature:         0 Kelvin (-273 Celsius)
Temperature Threshold:       0 Kelvin (-273 Celsius)
Available Spare:             0%
Available Spare Threshold:   0%
Life Percentage Used:        0%
Data Units Read:             0
Data Units Written:          0
Host Read Commands:          0
Host Write Commands:         0
Controller Busy Time:        0 minutes
Power Cycles:                0
Power On Hours:              0 hours
Unsafe Shutdowns:            0
Unrecoverable Media Errors:  0
Lifetime Error Log Entries:  0
Warning Temperature Time:    0 minutes
Critical Temperature Time:   0 minutes

Number of Queues
================
Number of I/O Submission Queues:      33
Number of I/O Completion Queues:      33

Active Namespaces
=================
Namespace ID:1
Command Set Identifier:                NVM (00h)
Deallocate:                            Not Supported
Deallocated/Unwritten Error:           Not Supported
Deallocated Read Value:                Unknown
Deallocate in Write Zeroes:            Not Supported
Deallocated Guard Field:               0xFFFF
Flush:                                 Not Supported
Reservation:                           Not Supported
Namespace Sharing Capabilities:        Private
Size (in LBAs):                        2097152 (1GiB)
Capacity (in LBAs):                    2097152 (1GiB)
Utilization (in LBAs):                 2097152 (1GiB)
NGUID:                                 1D3F8E91E0E61844949E6FC7FC126538
Thin Provisioning:                     Not Supported
Per-NS Atomic Units:                   No
NGUID/EUI64 Never Reused:              No
Number of LBA Formats:                 1
Current LBA Format:                    LBA Format #00
LBA Format #00: Data Size:   512  Metadata Size:     0

在test目录运行nvme测试案例

1、运行aer测试案例

vagrant@vagrant:~/spdk$ ./test/nvme/aer/aer -r 'trtype:PCIe traddr:00:0e.0'
[2021-08-31 10:47:59.658341] Starting SPDK v21.04.1-pre git sha1 7dc38f83f / DPDK 20.11.0 initialization...
[2021-08-31 10:47:59.658461] [ DPDK EAL parameters: [2021-08-31 10:47:59.658469] aer [2021-08-31 10:47:59.658473] --no-shconf [2021-08-31 10:47:59.658486] -c 0x1 [2021-08-31 10:47:59.658495] --log-level=lib.eal:6 [2021-08-31 10:47:59.658500] --log-level=lib.cryptodev:5 [2021-08-31 10:47:59.658503] --log-level=user1:6 [2021-08-31 10:47:59.658510] --iova-mode=pa [2021-08-31 10:47:59.658514] --base-virtaddr=0x200000000000 [2021-08-31 10:47:59.658519] --match-allocations [2021-08-31 10:47:59.658523] --file-prefix=spdk_pid29926 [2021-08-31 10:47:59.658527] ]
EAL: FATAL: Cannot use IOVA as 'PA' since physical addresses are not available
EAL: Cannot use IOVA as 'PA' since physical addresses are not available
[2021-08-31 10:47:59.662344] init.c: 587:spdk_env_init: *ERROR*: Failed to initialize DPDK
Unable to initialize SPDK env
vagrant@vagrant:~/spdk$ sudo ./test/nvme/aer/aer -r 'trtype:PCIe traddr:00:0e.0'
[2021-08-31 10:48:04.770409] Starting SPDK v21.04.1-pre git sha1 7dc38f83f / DPDK 20.11.0 initialization...
[2021-08-31 10:48:04.770507] [ DPDK EAL parameters: [2021-08-31 10:48:04.770549] aer [2021-08-31 10:48:04.770571] --no-shconf [2021-08-31 10:48:04.770598] -c 0x1 [2021-08-31 10:48:04.770622] --log-level=lib.eal:6 [2021-08-31 10:48:04.770637] --log-level=lib.cryptodev:5 [2021-08-31 10:48:04.770646] --log-level=user1:6 [2021-08-31 10:48:04.770656] --iova-mode=pa [2021-08-31 10:48:04.770665] --base-virtaddr=0x200000000000 [2021-08-31 10:48:04.770687] --match-allocations [2021-08-31 10:48:04.770695] --file-prefix=spdk_pid29929 [2021-08-31 10:48:04.770699] ]
EAL: No legacy callbacks, legacy socket not created
Asynchronous Event Request test
Attaching to 0000:00:0e.0
Attached to 0000:00:0e.0
Registering asynchronous event callbacks...
Cleaning up...

2、运行e2edp测试案例

vagrant@vagrant:~/spdk$ sudo ./test/nvme/e2edp/nvme_dp                          
[2021-08-31 10:49:23.562278] Starting SPDK v21.04.1-pre git sha1 7dc38f83f / DPDK 20.11.0 initialization...
[2021-08-31 10:49:23.562359] [ DPDK EAL parameters: [2021-08-31 10:49:23.562371] nvme_dp [2021-08-31 10:49:23.562376] -c 0x1 [2021-08-31 10:49:23.562379] --log-level=lib.eal:6 [2021-08-31 10:49:23.562383] --log-level=lib.cryptodev:5 [2021-08-31 10:49:23.562387] --log-level=user1:6 [2021-08-31 10:49:23.562391] --iova-mode=pa [2021-08-31 10:49:23.562395] --base-virtaddr=0x200000000000 [2021-08-31 10:49:23.562398] --match-allocations [2021-08-31 10:49:23.562402] --file-prefix=spdk0 [2021-08-31 10:49:23.562406] --proc-type=auto [2021-08-31 10:49:23.562410] ]
EAL: No legacy callbacks, legacy socket not created
NVMe Write/Read with End-to-End data protection test
Attaching to 0000:00:0e.0
Attached to 0000:00:0e.0
Cleaning up...

3、运行run_perf.sh命令

vagrant@vagrant:~/spdk$ sudo ./test/nvme/perf/run_perf.sh --numjobs=1 --iodepth=128  --rw=randread --fio-bin=/usr/src/fio/fio --ramp-time=10 --run-time=10
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SPDK(存储性能开发套件)官方文档中文版。 第一章 简介 1 1.1.什么是SPDK? 1 1.2.入门 1 1.3. Vagrant开发环境 3 1.4.更新日志(略) 6 第二章 概念 6 2.1. 用户空间驱动程序** 6 2.2. 来自用户空间的DMA** 7 2.3. 消息传递和并发** 9 2.4. NAND Flash SSD内部 13 2.5. 将I / O提交到NVMe设备** 15 2.5.1 NVMe规范 15 2.5.2 SPDK NVMe驱动程序I / O路径 15 2.6. 使用Vhost-user进行虚拟化I / O. 16 2.6.1 介绍 16 2.6.2 QEMU 17 2.6.3 设备初始化 18 2.6.4 I / O路径 19 2.6.5 SPDK优化 20 2.7. SPDK目录结构概述 20 2.8. SPDK移植指南 22 第三章 用户指南 22 3.1. 系统配置用户指南 22 3.1.1 IOMMU配置 22 3.2. SPDK应用程序概述 23 3.2.1 配置SPDK应用程序 23 3.3. iSCSI Target 26 3.3.1. iSCSI Target入门指南 26 3.3.2. 通过配置文件配置iSCSI Target 27 3.3.3. 通过RPC方法配置iSCSI Target 28 3.3.4. 配置iSCSI启动器 29 3.3.5. rpc配置示例*** 30 3.3.6. iSCSI 热插拔 32 3.4. NVMe over Fabrics Target 32 3.5. Vhost Target(略) 37 3.6 块设备用户指南 38 3.6.1 bdev介绍 38 3.6.2 通用RPC命令 38 3.6.3 Ceph RBD 39 3.6.4 压缩虚拟Bdev模块 40 3.6.5 加密虚拟Bdev模块 41 3.6.6 延迟vbdev模块 41 3.6.7 GPT(GUID分区表) 42 3.6.8 iSCSI bdev 43 3.6.9 Linux AIO bdev 43 3.6.10 OCF虚拟bdev 43 3.6.11 Malloc bdev 44 3.6.12 NULL bdev 44 3.6.13 NVMe bdev 44 3.6.14 逻辑卷Lvol 45 3.6.15 RAID 46 3.6.16 Passthru 46 3.6.17 Pmem 46 3.6.18 Virtio Block 47 3.6.19 Virtio SCSI 47 3.7 BlobFS(Blobstore文件系统) 48 3.7.1 RocksDB集成 48 3.7.2 FUSE插件 49 3.8 JSON-RPC方法(略) 49 第四章 程序员指南 49 4.1. Blobstore程序员指南 49 4.1.1 介绍 50 4.1.2 运作理论 50 4.1.3 设计注意事项 52 4.1.4 例子 54 4.1.5配置 54 4.1.6 组件细节 54 4.2. 块设备层编程指南 56 4.3 编写自定义块设备模块 58 4.3.1 介绍 58 4.3.2 创建一个新模块 59 4.3.3创建虚拟Bdev 60 4.4 NVMe over Fabrics目标编程指南 61 4.4.1 介绍 61 4.4.2 原语结构体 61 4.4.3 基础函数 62 4.4.4访问控制 62 4.4.5发现子系统 62 4.4.6 传输 63 4.4.7选择线程模型 63 4.4.8 跨CPU核心扩展 63 4.4.9 零拷贝支持 63 4.4.10 RDMA 63 4.5 Flash传输层 64 4.5.1 术语 64 4.5.2 使用方法 67 4.6 GDB宏用户指南 69 4.6.1 介绍 69 4.6.2 加载gdb宏 71 4.6.3 使用gdb数据目录 72 4.6.4 使用.gdbinit加载宏 72 4.6.5 为什么我们需要显式调用spdk_load_macros 72 4.6.6 以上可用的宏总结 73 4.6.7 添加新宏 73 4.7 SPDK “Reduce”块压缩算法 73 4.7.1 介绍 73 4.7.2 例子 74 4.8 通知库 78 第五章 基本信息 79 5.1 事件框架 79 5.1.1 事件框架设计注意事项 80 5.1.2 SPDK事件框架组件 80 5.1.3 应用框架 80 5.2 逻辑卷 81 5.2.1 术语 81 5.2.2 配置逻辑卷 84 5.3 矢量数据包处理(略) 86 第六章 杂项 86 6.1 介绍 86 6.2 NVMe的P2P API 86 6.3 确定设备支持 87 6.4 P2P问题 87 第七章 驱动程序 88 7.1 NVMe驱动程序*** 88 7.1.1 介绍 88 7.1.2 例子 88 7.1.3 公共接口 89 7.1.4 NVMe驱动程序设计 89 7.1.5 NVMe over Fabrics主机支持 91 7.1.6 NVMe多进程 91 7.1.7 NVMe Hotplug 92 7.2 I/OAT驱动程序 93 7.2.1 公共接口 93 7.2.2 关键功能 93 7.3 Virtio驱动程序 93 7.3.1 介绍 93 7.3.2 2MB大页面 93 第八章 工具 94 8.1 SPDK CLI 94 8.1.1 安装所需的依赖项 94 8.1.2 运行SPDK应用程序实例 94 8.1.3 运行SPDK CLI 94 8.1.4 可选 - 创建Python虚拟环境 94 8.2 nvme-CLI 95 8.2.1 nvme-cli with SPDK入门指南 95 8.2.2 使用场景 95 第九章 性能测试报告(略) 96 第十章NVMe-oF Target跟踪点*** 96 10.1 介绍 96 10.2 启用跟踪点 97 10.3 捕获事件的快照 97 10.4 捕获足够的跟踪事件 98 10.5 添加新的跟踪点 99

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值