2018-11-27 03:50:24 +00:00
|
|
|
.. _rgw_dynamic_bucket_index_resharding:
|
|
|
|
|
2017-06-26 11:58:49 +00:00
|
|
|
===================================
|
|
|
|
RGW Dynamic Bucket Index Resharding
|
|
|
|
===================================
|
|
|
|
|
|
|
|
.. versionadded:: Luminous
|
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
A large bucket index can lead to performance problems, which can
|
|
|
|
be addressed by sharding bucket indexes.
|
2017-06-26 11:58:49 +00:00
|
|
|
Until Luminous, changing the number of bucket shards (resharding)
|
2023-11-04 15:06:25 +00:00
|
|
|
needed to be done offline, with RGW services disabled.
|
|
|
|
Since the Luminous release Ceph has supported online bucket resharding.
|
2017-06-26 11:58:49 +00:00
|
|
|
|
|
|
|
Each bucket index shard can handle its entries efficiently up until
|
2023-11-04 15:06:25 +00:00
|
|
|
reaching a certain threshold. If this threshold is
|
2020-10-07 22:21:28 +00:00
|
|
|
exceeded the system can suffer from performance issues. The dynamic
|
2019-10-07 23:38:07 +00:00
|
|
|
resharding feature detects this situation and automatically increases
|
2023-11-04 15:06:25 +00:00
|
|
|
the number of shards used by a bucket's index, resulting in a
|
|
|
|
reduction of the number of entries in each shard. This
|
|
|
|
process is transparent to the user. Writes to the target bucket
|
|
|
|
are blocked (but reads are not) briefly during resharding process.
|
2019-10-07 23:38:07 +00:00
|
|
|
|
|
|
|
By default dynamic bucket index resharding can only increase the
|
2020-10-07 22:21:28 +00:00
|
|
|
number of bucket index shards to 1999, although this upper-bound is a
|
|
|
|
configuration parameter (see Configuration below). When
|
2023-11-04 15:06:25 +00:00
|
|
|
possible, the process chooses a prime number of shards in order to
|
|
|
|
spread the number of entries across the bucket index
|
2019-10-07 23:38:07 +00:00
|
|
|
shards more evenly.
|
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
Detection of resharding opportunities runs as a background process
|
|
|
|
that periodically
|
|
|
|
scans all buckets. A bucket that requires resharding is added to
|
|
|
|
a queue. A thread runs in the background and processes the queueued
|
|
|
|
resharding tasks, one at a time and in order.
|
2017-06-26 11:58:49 +00:00
|
|
|
|
|
|
|
Multisite
|
|
|
|
=========
|
2019-03-28 17:30:08 +00:00
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
With Ceph releases Prior to Reef, the Ceph Object Gateway (RGW) does not support
|
|
|
|
dynamic resharding in a
|
2023-05-18 21:07:02 +00:00
|
|
|
multisite environment. For information on dynamic resharding, see
|
|
|
|
:ref:`Resharding <feature_resharding>` in the RGW multisite documentation.
|
2017-06-26 11:58:49 +00:00
|
|
|
|
|
|
|
Configuration
|
|
|
|
=============
|
|
|
|
|
2024-04-17 17:17:40 +00:00
|
|
|
.. confval:: rgw_dynamic_resharding
|
|
|
|
.. confval:: rgw_max_objs_per_shard
|
|
|
|
.. confval:: rgw_max_dynamic_shards
|
|
|
|
.. confval:: rgw_reshard_bucket_lock_duration
|
|
|
|
.. confval:: rgw_reshard_thread_interval
|
|
|
|
.. confval:: rgw_reshard_num_logs
|
2024-08-24 09:03:13 +00:00
|
|
|
.. confval:: rgw_reshard_progress_judge_interval
|
|
|
|
.. confval:: rgw_reshard_progress_judge_ratio
|
2024-03-19 04:37:05 +00:00
|
|
|
|
2017-06-26 11:58:49 +00:00
|
|
|
Admin commands
|
|
|
|
==============
|
|
|
|
|
|
|
|
Add a bucket to the resharding queue
|
|
|
|
------------------------------------
|
2018-03-20 08:49:32 +00:00
|
|
|
|
2017-06-26 11:58:49 +00:00
|
|
|
::
|
2018-03-20 08:49:32 +00:00
|
|
|
|
|
|
|
# radosgw-admin reshard add --bucket <bucket_name> --num-shards <new number of shards>
|
2017-06-26 11:58:49 +00:00
|
|
|
|
|
|
|
List resharding queue
|
|
|
|
---------------------
|
2018-03-20 08:49:32 +00:00
|
|
|
|
2017-06-26 11:58:49 +00:00
|
|
|
::
|
2018-03-20 08:49:32 +00:00
|
|
|
|
2017-10-31 12:59:07 +00:00
|
|
|
# radosgw-admin reshard list
|
2017-06-26 11:58:49 +00:00
|
|
|
|
2019-03-28 17:30:08 +00:00
|
|
|
Process tasks on the resharding queue
|
|
|
|
-------------------------------------
|
2018-03-20 08:49:32 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
2017-06-26 11:58:49 +00:00
|
|
|
# radosgw-admin reshard process
|
|
|
|
|
2018-03-20 08:49:32 +00:00
|
|
|
Bucket resharding status
|
2017-06-26 11:58:49 +00:00
|
|
|
------------------------
|
2018-03-20 08:49:32 +00:00
|
|
|
|
2017-06-26 11:58:49 +00:00
|
|
|
::
|
2018-03-20 08:49:32 +00:00
|
|
|
|
|
|
|
# radosgw-admin reshard status --bucket <bucket_name>
|
2017-06-26 11:58:49 +00:00
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
The output is a JSON array of 3 objects (reshard_status, new_bucket_instance_id, num_shards) per shard.
|
2018-12-11 17:43:32 +00:00
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
For example, the output at each dynamic resharding stage is shown below:
|
2018-12-11 17:43:32 +00:00
|
|
|
|
|
|
|
``1. Before resharding occurred:``
|
|
|
|
::
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
2019-05-12 13:45:30 +00:00
|
|
|
"reshard_status": "not-resharding",
|
2018-12-11 17:43:32 +00:00
|
|
|
"new_bucket_instance_id": "",
|
|
|
|
"num_shards": -1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
``2. During resharding:``
|
|
|
|
::
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
2019-05-12 13:45:30 +00:00
|
|
|
"reshard_status": "in-progress",
|
2018-12-11 17:43:32 +00:00
|
|
|
"new_bucket_instance_id": "1179f470-2ebf-4630-8ec3-c9922da887fd.8652.1",
|
|
|
|
"num_shards": 2
|
|
|
|
},
|
|
|
|
{
|
2019-05-12 13:45:30 +00:00
|
|
|
"reshard_status": "in-progress",
|
2018-12-11 17:43:32 +00:00
|
|
|
"new_bucket_instance_id": "1179f470-2ebf-4630-8ec3-c9922da887fd.8652.1",
|
|
|
|
"num_shards": 2
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2023-10-31 15:20:05 +00:00
|
|
|
``3. After resharding completed:``
|
2018-12-11 17:43:32 +00:00
|
|
|
::
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
2019-05-12 13:45:30 +00:00
|
|
|
"reshard_status": "not-resharding",
|
2018-12-11 17:43:32 +00:00
|
|
|
"new_bucket_instance_id": "",
|
|
|
|
"num_shards": -1
|
|
|
|
},
|
|
|
|
{
|
2019-05-12 13:45:30 +00:00
|
|
|
"reshard_status": "not-resharding",
|
2018-12-11 17:43:32 +00:00
|
|
|
"new_bucket_instance_id": "",
|
|
|
|
"num_shards": -1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2017-06-26 11:58:49 +00:00
|
|
|
Cancel pending bucket resharding
|
|
|
|
--------------------------------
|
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
Note: Bucket resharding operations cannot be cancelled while executing. ::
|
2017-06-26 11:58:49 +00:00
|
|
|
|
2018-03-20 08:49:32 +00:00
|
|
|
# radosgw-admin reshard cancel --bucket <bucket_name>
|
2017-06-26 11:58:49 +00:00
|
|
|
|
2019-03-28 17:30:08 +00:00
|
|
|
Manual immediate bucket resharding
|
|
|
|
----------------------------------
|
2018-03-20 08:49:32 +00:00
|
|
|
|
2017-06-26 11:58:49 +00:00
|
|
|
::
|
|
|
|
|
2018-03-20 08:49:32 +00:00
|
|
|
# radosgw-admin bucket reshard --bucket <bucket_name> --num-shards <new number of shards>
|
2019-03-08 15:57:28 +00:00
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
When choosing a number of shards, the administrator must anticipate each
|
|
|
|
bucket's peak number of objects. Ideally one should aim for no
|
|
|
|
more than 100000 entries per shard at any given time.
|
2019-10-07 23:38:07 +00:00
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
Additionally, bucket index shards that are prime numbers are more effective
|
|
|
|
in evenly distributing bucket index entries.
|
|
|
|
For example, 7001 bucket index shards is better than 7000
|
2019-10-07 23:38:07 +00:00
|
|
|
since the former is prime. A variety of web sites have lists of prime
|
2023-11-04 15:06:25 +00:00
|
|
|
numbers; search for "list of prime numbers" with your favorite
|
2019-10-07 23:38:07 +00:00
|
|
|
search engine to locate some web sites.
|
2019-03-08 15:57:28 +00:00
|
|
|
|
|
|
|
Troubleshooting
|
|
|
|
===============
|
|
|
|
|
|
|
|
Clusters prior to Luminous 12.2.11 and Mimic 13.2.5 left behind stale bucket
|
2023-11-04 15:06:25 +00:00
|
|
|
instance entries, which were not automatically cleaned up. This issue also affected
|
|
|
|
LifeCycle policies, which were no longer applied to resharded buckets. Both of
|
|
|
|
these issues could be worked around by running ``radosgw-admin`` commands.
|
2019-03-08 15:57:28 +00:00
|
|
|
|
2019-03-28 17:30:08 +00:00
|
|
|
Stale instance management
|
2019-03-08 15:57:28 +00:00
|
|
|
-------------------------
|
|
|
|
|
2019-03-28 17:30:08 +00:00
|
|
|
List the stale instances in a cluster that are ready to be cleaned up.
|
|
|
|
|
2019-03-08 15:57:28 +00:00
|
|
|
::
|
|
|
|
|
|
|
|
# radosgw-admin reshard stale-instances list
|
|
|
|
|
2019-03-28 17:30:08 +00:00
|
|
|
Clean up the stale instances in a cluster. Note: cleanup of these
|
2023-11-04 15:06:25 +00:00
|
|
|
instances should only be done on a single-site cluster.
|
2019-03-08 15:57:28 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# radosgw-admin reshard stale-instances rm
|
|
|
|
|
|
|
|
|
|
|
|
Lifecycle fixes
|
|
|
|
---------------
|
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
For clusters with resharded instances, it is highly likely that the old
|
2019-03-28 17:30:08 +00:00
|
|
|
lifecycle processes would have flagged and deleted lifecycle processing as the
|
2023-11-04 15:06:25 +00:00
|
|
|
bucket instance changed during a reshard. While this is fixed for buckets
|
|
|
|
deployed on newer Ceph releases (from Mimic 13.2.6 and Luminous 12.2.12),
|
|
|
|
older buckets that had lifecycle policies and that have undergone
|
|
|
|
resharding must be fixed manually.
|
2019-03-28 17:30:08 +00:00
|
|
|
|
|
|
|
The command to do so is:
|
2019-03-08 15:57:28 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# radosgw-admin lc reshard fix --bucket {bucketname}
|
|
|
|
|
|
|
|
|
2023-11-04 15:06:25 +00:00
|
|
|
If the ``--bucket`` argument is not provided, this
|
|
|
|
command will try to fix lifecycle policies for all the buckets in the cluster.
|
2019-05-02 13:25:22 +00:00
|
|
|
|
|
|
|
Object Expirer fixes
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
Objects subject to Swift object expiration on older clusters may have
|
|
|
|
been dropped from the log pool and never deleted after the bucket was
|
|
|
|
resharded. This would happen if their expiration time was before the
|
|
|
|
cluster was upgraded, but if their expiration was after the upgrade
|
|
|
|
the objects would be correctly handled. To manage these expire-stale
|
2023-11-04 15:06:25 +00:00
|
|
|
objects, ``radosgw-admin`` provides two subcommands.
|
2019-05-02 13:25:22 +00:00
|
|
|
|
|
|
|
Listing:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# radosgw-admin objects expire-stale list --bucket {bucketname}
|
|
|
|
|
|
|
|
Displays a list of object names and expiration times in JSON format.
|
|
|
|
|
|
|
|
Deleting:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# radosgw-admin objects expire-stale rm --bucket {bucketname}
|
|
|
|
|
|
|
|
|
|
|
|
Initiates deletion of such objects, displaying a list of object names, expiration times, and deletion status in JSON format.
|