rgw bucket index max shards设置

本文介绍了Ceph RADOS Gateway (RGW) 中bucket index sharding的概念及其重要性。当bucket中的对象数量增加时,通过将bucket index分成多个部分来提高并行性和负载均衡,从而避免性能瓶颈。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. # radosgw-admin zonegroup --rgw_zonegroup=default get > /root/zonegroup.json


{
    "id": "3c5cc9c6-7e31-46cd-ac6d-652ce466c879",
    "name": "default",
    "api_name": "",
    "is_master": "true",
    "endpoints": [],
    "hostnames": [],
    "hostnames_s3website": [],
    "master_zone": "b70f0b56-08a0-472a-880f-6114f593c972",
    "zones": [
        {
            "id": "b70f0b56-08a0-472a-880f-6114f593c972",
            "name": "default",
            "endpoints": [],
            "log_meta": "false",
            "log_data": "false",
            "bucket_index_max_shards": 0,
            "read_only": "false",
            "tier_type": "",
            "sync_from_all": "true",
            "sync_from": []
        }
    ],
    "placement_targets": [
        {
            "name": "default-placement",
            "tags": []
        }
    ],
    "default_placement": "default-placement",
    "realm_id": "f43494f8-bfb6-4723-b169-6ba929cdca1c"
}

2.# adosgw-admin zonegroup --rgw_zonegroup=default set < /root/zonegroup.json

{
    "id": "3c5cc9c6-7e31-46cd-ac6d-652ce466c879",
    "name": "default",
    "api_name": "",
    "is_master": "true",
    "endpoints": [],
    "hostnames": [],
    "hostnames_s3website": [],
    "master_zone": "b70f0b56-08a0-472a-880f-6114f593c972",
    "zones": [
        {
            "id": "b70f0b56-08a0-472a-880f-6114f593c972",
            "name": "default",
            "endpoints": [],
            "log_meta": "false",
            "log_data": "false",
            "bucket_index_max_shards": 4,
            "read_only": "false",
            "tier_type": "",
            "sync_from_all": "true",
            "sync_from": []
        }
    ],
    "placement_targets": [
        {
            "name": "default-placement",
            "tags": []
        }
    ],
    "default_placement": "default-placement",
    "realm_id": "f43494f8-bfb6-4723-b169-6ba929cdca1c"
}

3. # radosgw-admin regionmap update

4. 重启rgw服务,即可生效

5. 创建一个bucket

# swift -V 1.0 -A http://127.0.0.1:8000/auth -U test:tester -K testing post test2

.dir.b70f0b56-08a0-472a-880f-6114f593c972.4144.3.0
.dir.b70f0b56-08a0-472a-880f-6114f593c972.4144.3.1
.dir.b70f0b56-08a0-472a-880f-6114f593c972.4144.3.2
.dir.b70f0b56-08a0-472a-880f-6114f593c972.4144.3.3


6. 为什么设置rgw bucket index max shards

Sharding is the process of breaking down data onto multiple locations so as to increase parallelism, as well as distribute load. This is a common feature used in databases. Read more on this at Wikipedia.


The concept of sharding is used in Ceph, for splitting the bucket index in a RADOS Gateway.


RGW or RADOS Gateway keeps an index for all the objects in its buckets for faster and easier lookup. For each RGW bucket created in a pool, the corresponding index is created in the XX.index pool.


For example, for each of the buckets created in .rgw pool, the bucket index is created in .rgw.buckets.index pool. For each bucket, the index is stored in a single RADOS object.


When the number of objects increases, the size of the RADOS object increases as well. Two problems arise due to the increased index size.


RADOS does not work good with large objects since it’s not designed as such. Operations such as recovery, scrubbing etc.. work on a single object. If the object size increases, OSDs may start hitting timeouts because reading a large object may take a long time. This is one of the reason that all RADOS client interfaces such as RBD, RGW, CephFS use a standard 4MB object size.
Since the index is stored in a single RADOS object, only a single operation can be done on it at any given time. When the number of objects increases, the index stored in the RADOS object grows. Since a single index is handling a large number of objects, and there is a chance the number of operations also increase, parallelism is not possible which can end up being a bottleneck. Multiple operations will need to wait in a queue since a single operation is possible at a time.
In order to work around these problems, the bucket index is sharded into multiple parts. Each shard is kept on a separate RADOS object within the index pool.


Sharding is configured with the tunable bucket_index_max_shards . By default, this tunable is set to 0 which means that there are no sha


7. 注意和rgw_override_bucket_index_max_shards 的区别

用户可能会在一个bucket中存放过多的object,这会严重影响系统性能;通过定义 rgw_override_bucket_index_max_shards 可以限制最大多少个shards在一个bucket中,默认这个值是0,也就是“无数个”。
rgw_override_bucket_index_max_shards = 1000



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值