百亿对象性能调优
Ceph对象存储场景,应用对象数达到百亿级别,在客户现网配置下元数据溢出严重,导致读写性能下降严重。本特性通过NVME空间的重新配置、压缩使能、Bcache参数调优等手段提升该场景下的读写性能。
硬件配置
项目 |
描述 |
|---|---|
服务器 |
Kunpeng 920 4U机型 |
CPU型号 |
鲲鹏920 5220处理器 |
内存 |
12*32G |
网络 |
4*25GE |
SSD |
2*7.68TB |
HDD |
36*16TB |
配置NVMe
- 目的
通过调整OSD DB的NVME空间,让OSD能承载更多元数据,避免在百亿对象场景下出现元数据溢出,导致读写性能下降严重。
- 方法
每个OSD能分到14.6T/36=400G的空间,100G做为Bcache缓存盘,300G做为DB/WAL空间,结合元数据压缩,最终每个OSD可承载元数据超过800GB。
使能zstd压缩
- 请参见《鲲鹏BoostKit 分布式存储算法加速库 开发指南》中的“编译安装KSAL zstd算法包”章节,完成编译与安装。
- 获取ceph-14.2.8源码,并放置到“/home”目录下。
- 获取Ceph中RocksDB使能zstd的patch,并放置到“/home”目录下。
- 进入“/home”目录,解压Ceph源码包,进入Ceph源码目录,合入补丁。
1 2
cd /home && tar -zxvf ceph-14.2.8.tar.gz && cd ceph-14.2.8 patch -p1 < ../ceph-ksal-zstd-plugin.patch
- 修改完源码后需要重新编译Ceph,编译步骤请参见《Ceph 14.2.8 编译指南(CentOS 7.6&openEuler 20.03&openEuler 22.03)》。
- 完成Ceph软件安装,具体请参见《Ceph对象存储 部署指南(CentOS 7.6&openEuler 20.03&openEuler 22.03)》的“安装Ceph”和“验证Ceph”章节。
- 执行以下命令修改ceph.conf,完成zstd压缩配置。
该步骤需在部署osd之前完成。
1 2
[osd] bluestore_rocksdb_options="compression=kZSTD,compression_per_level=kNoCompression:kNoCompression:kZSTD:kZSTD:kZSTD,max_write_buffer_number=4,min_write_buffer_number_to_merge=1,recycle_log_file_num=4,write_buffer_size=268435456,writable_file_max_buffer_size=0,compaction_readahead_size=2097152,max_background_compactions=2"
Bcache参数配置优化
- 目的
针对DB使用SSD,DATA使用Bcache(SSD + HDD)的场景,对Bcache使用设备以及Bcache软件做参数调整,提升基础写性能。
- 方法
具体优化项如表1所示。
表1 Bcache参数调整 参数名称
参数含义
优化建议
设备参数
Bcache使用缓存盘和数据盘设备的硬件参数
软件参数
Bcache软件运行时动态指定的参数
修改方式:运行如下脚本。1 2 3 4 5 6 7 8 9 10
#!/bin/bash for f in `ls -d /sys/block/bcache*` do echo writeback > $f/bcache/cache_mode echo 0 > $f/bcache/cache/congested_read_threshold_us echo 2000000 > $f/bcache/cache/congested_write_threshold_us echo 0 > $f/bcache/readahead echo 0 > $f/bcache/sequential_cutoff done
RGW参数配置
- 目的
基于对象数调整对象网关分片数,避免一个索引分片记录kv过多影响性能。
- 方法具体优化项如表2所示。
表2 rgw参数配置 参数名称
参数含义
优化建议
rgw_dynamic_resharding
动态分片开关
默认值:true
修改方式:
在ceph.conf的[global]标签下增加如下内容,关闭动态分片开关。1rgw_dynamic_resharding = false
bucket_index_max_shards
桶索引分片数
默认值:1
修改方式:
- 启动rgw后,执行如下命令获取默认配置。
1radosgw-admin zonegroup get > default.json
- 修改default.json中bucket_index_max_shards参数,此处举例将数量设置为该桶内最终承载的对象数/20W,以百亿为例,桶分片数需要设为50000,修改后保存。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
{ "id": "fe30f363-6c02-4cfc-982f-cf22e1090f34", "name": "default", "api_name": "default", "is_master": "true", "endpoints": [], "hostnames": [], "hostnames_s3website": [], "master_zone": "340b719a-c970-4178-8b3a-3b308ed1002c", "zones": [ { "id": "340b719a-c970-4178-8b3a-3b308ed1002c", "name": "default", "endpoints": [], "log_meta": "false", "log_data": "false", "bucket_index_max_shards": 50000, "read_only": "false", "tier_type": "", "sync_from_all": "true", "sync_from": [], "redirect_zone": "" } ], "placement_targets": [ { "name": "default-placement", "tags": [], "storage_classes": [ "STANDARD" ] } ], "default_placement": "default-placement", "realm_id": "" }
- 执行如下命令,使用修改后的配置覆盖原来的配置。
1radosgw-admin zonegroup set < default.json
- 重启rgw让配置生效。
1systemctl restart ceph-radosgw.target
- 启动rgw后,执行如下命令获取默认配置。
父主题: 均衡型配置调优