Resharding bucket index dynamically

Dynamic resharding is a process where the system automatically reshards the bucket index without requiring manual intervention. The system monitors factors like data distribution and triggers resharding when necessary to optimize storage and performance.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • A running IBM Storage Ceph cluster.
  • A Ceph Object Gateway installed.

About this task

When dynamic resharding is needed, the system automatically adds the bucket to the resharding queue, and background threads perform the resharding one bucket at a time. This ensures the system adapts to changing demands efficiently.

This process is seamless and happens in the background, allowing the system to adjust dynamically to varying workloads without admin intervention.

Procedure

  1. In the Ceph configuration file, set the rgw_dynamic_resharding parameter to true.
    ceph config set client.rgw OPTION VALUE
    For example,
    [ceph: root@host01 /]# ceph config set client.rgw rgw_dynamic_resharding true
  2. Optional: Customize the Ceph configuration with any of the optional parameters.
    ceph config set client.rgw OPTION VALUE
    Table 1. Ceph configuration options for dynamic resharding
    Parameter option Description Default value
    rgw_reshard_num_logs The number of shards for the resharding log. 16
    rgw_reshard_bucket_lock_duration The duration in seconds of the lock on a bucket during resharding. 360
    rgw_dynamic_resharding A boolean value that enables or disables dynamic resharding. true
    rgw_max_objs_per_shard The maximum number of objects per shard. 100000
    rgw_reshard_thread_interval The maximum time in seconds between rounds of reshard thread processing. 600
    rgw_dynamic_resharding_may_reduce Set to true to allow shard reduction during dynamic resharding. Must be used with rgw_dynamic_reshard set to true for dynamic resharding. true
    rgw_dynamic_resharding_reduction_wait Defines the wait time in hours before performing a reduction after identifying a bucket for reduction.
    This option provides a protection mechanism to prevent constant resharding due to fluctuating object counts.
    Note: A low value can affect cluster performance for buckets with frequent object count fluctuations.
    120
    The following example increases the number of shards for the resharding log to 23.
    [ceph: root@host01 /]# ceph config set client.rgw rgw_reshard_num_logs 23 
  3. Add a bucket to the resharding queue.
    radosgw-admin reshard add --bucket BUCKET --num-shards NUMBER
    For example,
    [ceph: root@host01 /]# radosgw-admin reshard add --bucket data --num-shards 10
  4. List the resharding queue.
    radosgw-admin reshard list
    For example,
    [ceph: root@host01 /]# radosgw-admin reshard list
  5. Check the bucket log generations and shards.
    radosgw-admin bucket layout --bucket data
    For example,
    [ceph: root@host01 /]# radosgw-admin bucket layout --bucket data
    {
        "layout": {
            "resharding": "None",
            "current_index": {
                "gen": 1,
                "layout": {
                    "type": "Normal",
                    "normal": {
                        "num_shards": 23,
                        "hash_type": "Mod"
                    }
                }
            },
            "logs": [
                {
                    "gen": 0,
                    "layout": {
                        "type": "InIndex",
                        "in_index": {
                            "gen": 0,
                            "layout": {
                                "num_shards": 11,
                                "hash_type": "Mod"
                            }
                        }
                    }
                },
                {
                    "gen": 1,
                    "layout": {
                        "type": "InIndex",
                        "in_index": {
                            "gen": 1,
                            "layout": {
                                "num_shards": 23,
                                "hash_type": "Mod"
                            }
                        }
                    }
                }
            ]
        }
    }
  6. Check bucket resharding status.
    radosgw-admin reshard status --bucket BUCKET
    For example,
    [ceph: root@host01 /]# radosgw-admin reshard status --bucket data
  7. Immediately process task entries on the resharding queue.
    radosgw-admin reshard process
    For example,
    [ceph: root@host01 /]# radosgw-admin reshard process
  8. Optional: Cancel pending bucket resharding tasks.
    Important: You can only cancel pending resharding operations. Do not cancel ongoing resharding operations.
    radosgw-admin reshard cancel --bucket BUCKET
    For example,
    [ceph: root@host01 /]# radosgw-admin reshard cancel --bucket data

What to do next

Verify the bucket resharding status.
radosgw-admin reshard status --bucket BUCKET
For example,
[ceph: root@host01 /]# radosgw-admin reshard status --bucket data