searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

SPDK blobstore简介和实践

2024-04-30 02:34:46
56
0
## 简介
 
Blobstore是构建在spdk bdev层的一个逻辑对象管理层,每个blob对应一个对象,一个blob被逻辑上拆分成很多不连续的cluster,每个cluster又分为page。blobstore将blob元数据记录在磁盘头相关的page页,整个IO流都在用户态,具有非常好的读写性能,并具备掉电恢复等故障处理能力。
 
 
## 实践

*** 格式化一个NVMe设备为blobstore引擎 ***

```shell
[root@test examples]# cat blobcli.json
{
"subsystems": [
{
"subsystem":"bdev",
"config": [
{
"method":"bdev_nvme_attach_controller",
"params":{
"trtype":"PCIe",
"name":"Nvme1",
"traddr":"0000:68:00.0"
}
}
]
}
]
}

# -b 一定是 name+n1 这样子格式
[root@test examples]# ./blobcli -b Nvme1n1 -i blobcli.json
Your entire blobstore will be destroyed. Are you sure? (y/n) y
[2024-04-10 17:04:12.916671] Starting SPDK v23.01.1 git sha1 186986c / DPDK 22.11.1 initialization...
[2024-04-10 17:04:12.918661] [ DPDK EAL parameters: blobcli --no-shconf -c 0x1 --huge-unlink --log-level=lib.eal:6 --log-level=lib.cryptodev:5 --log-level=user1:6 --iova-mode=pa --base-virtaddr=0x200000000000 --match-allocations --file-prefix=spdk_pid3670165 ]
TELEMETRY: No legacy callbacks, legacy socket not created
[2024-04-10 17:04:13.073398] app.c: 712:spdk_app_start: *NOTICE*: Total cores available: 1
[2024-04-10 17:04:13.120114] reactor.c: 926:reactor_run: *NOTICE*: Reactor started on core 0
[2024-04-10 17:04:13.141979] accel_sw.c: 681:sw_accel_module_init: *NOTICE*: Accel framework software module initialized.
Init blobstore using bdev Name: Nvme1n1
blobstore init'd: (0x175f130)
```

*** 创建一个blob ***

```shell
# blobstore还是构建在bdev层之上的
[root@test examples]# ./blobcli -b Nvme1n1 -l bdevs
List bdevs:
bdevName:Nvme1n1
bdevProductName:NVMedisk
[root@test examples]# ./blobcli -b Nvme1n1 -n 1
New blob id 0x100000000
blob now has USED clusters of 1
[root@slg-poc-x86-ceph-1 examples]# ./blobcli -b Nvme1n1 -l blobs
List BLOBS:
Found blob with ID# 0x100000000
[root@test examples]# ./blobcli -b Nvme1n1 -s 0x100000000
Blob Public Info:
blob ID: 0x100000000
# of clusters: 1
# of bytes: 1048576
# of pages: 256
# of xattrs: 0
xattrs:

Blob Private Info:
state: CLEAN
open ref count: 1
[root@test examples]# ./blobcli -b Nvme1n1 -s bs
Blobstore Public Info:
UsingbdevProductName:NVMedisk
APIVersion:3
superblobID:noneassigned
pagesize:4096
iounitsize:512
clustersize:1048576
# free clusters: 7297030
blobstoretype:
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

Blobstore Private Info:
Metadatastart (pages): 673
Metadatalength (pages): 7325650
```

*** 读写一个blob ***

```shell
[root@test examples]# ./blobcli -b Nvme1n1 -m 0x100000000 test
[root@test examples]# ./blobcli -b Nvme1n1 -d 0x100000000 test1
```
0条评论
0 / 1000
邢****典
4文章数
0粉丝数
邢****典
4 文章 | 0 粉丝
邢****典
4文章数
0粉丝数
邢****典
4 文章 | 0 粉丝
原创

SPDK blobstore简介和实践

2024-04-30 02:34:46
56
0
## 简介
 
Blobstore是构建在spdk bdev层的一个逻辑对象管理层,每个blob对应一个对象,一个blob被逻辑上拆分成很多不连续的cluster,每个cluster又分为page。blobstore将blob元数据记录在磁盘头相关的page页,整个IO流都在用户态,具有非常好的读写性能,并具备掉电恢复等故障处理能力。
 
 
## 实践

*** 格式化一个NVMe设备为blobstore引擎 ***

```shell
[root@test examples]# cat blobcli.json
{
"subsystems": [
{
"subsystem":"bdev",
"config": [
{
"method":"bdev_nvme_attach_controller",
"params":{
"trtype":"PCIe",
"name":"Nvme1",
"traddr":"0000:68:00.0"
}
}
]
}
]
}

# -b 一定是 name+n1 这样子格式
[root@test examples]# ./blobcli -b Nvme1n1 -i blobcli.json
Your entire blobstore will be destroyed. Are you sure? (y/n) y
[2024-04-10 17:04:12.916671] Starting SPDK v23.01.1 git sha1 186986c / DPDK 22.11.1 initialization...
[2024-04-10 17:04:12.918661] [ DPDK EAL parameters: blobcli --no-shconf -c 0x1 --huge-unlink --log-level=lib.eal:6 --log-level=lib.cryptodev:5 --log-level=user1:6 --iova-mode=pa --base-virtaddr=0x200000000000 --match-allocations --file-prefix=spdk_pid3670165 ]
TELEMETRY: No legacy callbacks, legacy socket not created
[2024-04-10 17:04:13.073398] app.c: 712:spdk_app_start: *NOTICE*: Total cores available: 1
[2024-04-10 17:04:13.120114] reactor.c: 926:reactor_run: *NOTICE*: Reactor started on core 0
[2024-04-10 17:04:13.141979] accel_sw.c: 681:sw_accel_module_init: *NOTICE*: Accel framework software module initialized.
Init blobstore using bdev Name: Nvme1n1
blobstore init'd: (0x175f130)
```

*** 创建一个blob ***

```shell
# blobstore还是构建在bdev层之上的
[root@test examples]# ./blobcli -b Nvme1n1 -l bdevs
List bdevs:
bdevName:Nvme1n1
bdevProductName:NVMedisk
[root@test examples]# ./blobcli -b Nvme1n1 -n 1
New blob id 0x100000000
blob now has USED clusters of 1
[root@slg-poc-x86-ceph-1 examples]# ./blobcli -b Nvme1n1 -l blobs
List BLOBS:
Found blob with ID# 0x100000000
[root@test examples]# ./blobcli -b Nvme1n1 -s 0x100000000
Blob Public Info:
blob ID: 0x100000000
# of clusters: 1
# of bytes: 1048576
# of pages: 256
# of xattrs: 0
xattrs:

Blob Private Info:
state: CLEAN
open ref count: 1
[root@test examples]# ./blobcli -b Nvme1n1 -s bs
Blobstore Public Info:
UsingbdevProductName:NVMedisk
APIVersion:3
superblobID:noneassigned
pagesize:4096
iounitsize:512
clustersize:1048576
# free clusters: 7297030
blobstoretype:
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

Blobstore Private Info:
Metadatastart (pages): 673
Metadatalength (pages): 7325650
```

*** 读写一个blob ***

```shell
[root@test examples]# ./blobcli -b Nvme1n1 -m 0x100000000 test
[root@test examples]# ./blobcli -b Nvme1n1 -d 0x100000000 test1
```
文章来自个人专栏
存储
4 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
0
0