目的
利用 rbd 文件读写, 对 ceph 集群 io 进行测试
通过参数调整, 控制 IO 读写速度
检测 SSD 在日志盘进行读写时候是否会达到瓶颈
测试环境
rbd client 环境如下
服务器名称 | ip 地址 |
hh-yun-compute-131203.vclound.com | 10.199.131.203 |
hh-yun-compute-131204.vclound.com | 10.199.131.204 |
hh-yun-compute-131205.vclound.com | 10.199.131.205 |
hh-yun-compute-131207.vclound.com | 10.199.131.207 |
hh-yun-compute-131208.vclound.com | 10.199.131.208 |
rbd import VS rbd map 测试
目的
以相同环境测试, 测试一台至多台机器并发执行 rbd import 之间的速度对比
单机单文件数据传输测试
rbd import test
创建一个 4GB FILE, 非 dd file
利用 rbd 命令 import 文件到 ceph cluster
监控 import 时间,
监控 ceph journal disk io
监控 ceph sata disk io
监控 ceph cluster io
ID | 文件大小 | 完成时间 | ssd journal最大速度 | 单个 osd 最大速度A | 单个 osd 最大速度B | ceph 整体最大速度 |
1 | 4GB | 39s | 120MB/s | 50MB/s | 48MB/s | 105MB/s |
2 | 4GB | 41s | 118MB/s | 52MB/s | 52MB/s | 110MB/s |
3 | 4GB | 41s | 106MB/s | 44MB/s | 40MB/s | 106MB/s |
rbd map
对应操作系统内核版本
由于内存版本问题, CENTOS 7.2 执行 rbd map 时候将会出现下面错误信息
Dec 5 11:48:45 hh-yun-compute-131204 kernel: Key type dns_resolver registered
Dec 5 11:48:45 hh-yun-compute-131204 kernel: Key type ceph registered
Dec 5 11:48:45 hh-yun-compute-131204 kernel: libceph: loaded (mon/osd proto 15/24)
Dec 5 11:48:45 hh-yun-compute-131204 kernel: rbd: loaded (major 252)
Dec 5 11:48:45 hh-yun-compute-131204 kernel: libceph: mon1 10.199.128.214:6789 feature set mismatch, my 102b84a842a42 < server's 40102b84a842a42, missing 400000000000000
Dec 5 11:48:45 hh-yun-compute-131204 kernel: libceph: mon1 10.199.128.214:6789 missing required protocol features
解决方法
升级至少 CENTOS 7.3 以上
rbd feature disable 问题
[root@hh-yun-compute-131203 ~]# rbd map -p data --image rbdtestfile
rbd: sysfs write failed
RBD image feature set mismatch. Try disabling features unsupported by the kernel with "rbd feature disable".
In some cases useful info is found in syslog - try "dmesg | tail".
rbd: map failed: (6) No such device or address
解决方法
查询
[root@hh-yun-compute-131203 ~]# rbd info data/rbdtestfile
rbd image 'rbdtestfile':
size 10240 MB in 2560 objects
order 22 (4096 kB objects)
block_name_prefix: rbd_data.c28e32ae8944a
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten <- 关闭多余的 feature
flags:
create_timestamp: Tue Dec 5 11:22:27 2017
修改方法
[root@hh-yun-compute-131203 ~]# rbd feature disable data/rbdtestfile exclusive-lock object-map fast-diff deep-flatten
修改后查询
[root@hh-yun-compute-131203 ~]# rbd info data/rbdtestfile
rbd image 'rbdtestfile':
size 10240 MB in 2560 objects
order 22 (4096 kB objects)
block_name_prefix: rbd_data.c28e32ae8944a
format: 2
features: layering
flags:
create_timestamp: Tue Dec 5 11:22:27 2017
可选命令指定 feature
[root@hh-yun-compute-131203 ~]# rbd create --pool data --image newrbdfile --image-format 2 --image-feature layering --size 10G
[root@hh-yun-compute-131203 ~]# rbd info data/newrbdfile
rbd image 'newrbdfile':
size 10240 MB in 2560 objects
order 22 (4096 kB objects)
block_name_prefix: rbd_data.b59b22ae8944a
format: 2
features: layering
flags:
create_timestamp: Tue Dec 5 15:04:11 2017
永久修改方法
修改配置 /etc/ceph/ceph.conf
[osd]
rbd_default_features = 1
注意, 修改的是 client 端, 不是 server 端
执行 rbd map
[root@hh-yun-compute-131203 ~]# rbd map data/newrbdfile
/dev/rbd0
[root@hh-yun-compute-131203 ~]# ls -lh /dev/rbd0
brw-rw---- 1 root disk 252, 0 12月 5 16:13 /dev/rbd0 <- 新增的 rbd 设备文件
rbd map test
创建一个 4GB FILE, 非 dd file
利用 rbd map 命令把 rbd file 当做本地磁盘进行 IO 读写
监控 文件写入 时间,
监控 ceph journal disk io
监控 ceph sata disk io
监控 ceph cluster io
格式化
[root@hh-yun-compute-131203 ~]# mkfs -t xfs /dev/rbd0
meta-data=/dev/rbd0 isize=512 agcount=17, agsize=162816 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=1024 swidth=1024 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=8 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
挂载
[root@hh-yun-compute-131203 ~]# mount /dev/rbd0 /mnt
测试
ID | 文件大小 | 完成时间 | ssd journal最大速度 | 单个 osd 最大速度A | 单个 osd 最大速度B | ceph 整体最大速度 |
1 | 4GB | 40s | 120MB/s | 44MB/s | 48MB/s | 115MB/s |
2 | 4GB | 39s | 120MB/s | 40MB/s | 44MB/s | 125MB/s |
3 | 4GB | 39s | 132MB/s | 36MB/s | 40MB/s | 115MB/s |
总结
对于单机操作下, 对于 rbd mapping 与 rbd import 两种性能够上差不多
对于文件写情况下, ssd journal 都会比单个 OSD 的读写 IO 频繁
三台机单文件数据传输测试
三机器并发对 ceph 进行数据写入测试
rbd import
ID | 文件大小 | A完成时间 | B完成时间 | C完成时间 | ssd journal最大速度 | ssd journal TPS | 单个 osd 最大速度A | 单个 osd 最大速度B | 单个 osd 最大TPS | ceph 整体最大速度 |
1 | 4GB | 44s | 46s | 45s | 299MB/s | 1300 | 56MB/s | 59MB/s | 130 | 292MB/s |
2 | 4GB | 42s | 44s | 44s | 300MB/s | 1280 | 42MB/s | 56MB/s | 132 | 299MB/s |
3 | 4GB | 40s | 40s | 40s | 293MB/s | 1334 | 54MB/s | 52MB/s | 138 | 288MB/s |
总结
作为 ceph 跨集群迁移
建议利用 3 ~5 物理机进行并发 import 数据到新集群
过多的机器并发, 会先导致 journal disk 首先达到瓶颈
对于物理机 osd disk 与 journal disk 比例, 建议 5:1
具有 journal disk 会大大加速 osd disk 数据响应速度(即提高 ceph 集群性能)
参考
http://tracker.ceph.com/projects/ceph/wiki/Benchmark_Ceph_Cluster_Performance
http://ceph.com/planet/quick-analysis-of-the-ceph-io-layer/
http://www.sebastien-han.fr/blog/2014/10/10/ceph-how-to-test-if-your-ssd-is-suitable-as-a-journal-device/
https://github.com/bryanapperson/ceph-disk-test/blob/master/ceph_disk_test.sh
http://bryanapperson.com/blog/ceph-raw-disk-performance-testing/