Repository navigation
rgw/lc: optimize lifecycle processing for multiple rules - #66367
Merged
Merged
Conversation
mheler
force-pushed
the
lc-tag-scan-reduction
branch
from
November 21, 2025 19:13
cf876eb to
720187a
Compare
mheler
force-pushed
the
lc-tag-scan-reduction
branch
from
November 24, 2025 18:14
720187a to
3c07dfe
Compare
mheler
commented
Nov 26, 2025
Group lifecycle rules by prefix and process them in one bucket listing, filtering invalid or zone-incompatible rules before scanning so we avoid rescanning the bucket for each rule. Signed-off-by: Matthew N. Heler <[email protected]>
Currently, bucket_lc_process() spawns one coroutine per rule per object. This means for a bucket with N lifecycle rules, we spawn N coroutines for each object. This creates a workpool utilization problem when there are many rules. With the default rgw_lc_max_wp_worker=128 and 64 rules, only ~2 objects can be processed concurrently (128 / 64 ≈ 2). This severely limits parallelism and causes performance degradation when multiple tag-based or other rules are configured. This commit changes the concurrency model to spawn one coroutine per object instead. Each coroutine processes all applicable rules for that object sequentially. This allows the full workpool of 128 coroutines to process 128 objects concurrently, regardless of the number of rules. Additionally, this fixes a timing issue where rule.update() was called inside the async coroutine, potentially reading stale data from the shared LCObjsLister after it had advanced. Now all rules are updated before spawning to capture the correct lister state. Signed-off-by: Matthew N. Heler <[email protected]>
Prefetch tags once per object and pass them into LCOpRule, letting the tag filter reuse the cached set and skip tag-based rules early when tags are absent or mismatched. Signed-off-by: Matthew N. Heler <[email protected]>
mheler
force-pushed
the
lc-tag-scan-reduction
branch
from
December 12, 2025 12:38
3c07dfe to
f5c1759
Compare
mattbenjamin
approved these changes
Dec 12, 2025
mattbenjamin
left a comment
Contributor
There was a problem hiding this comment.
I think the prefix rule reorganization is well motivated, and author has proved that the size of cached tag info is bounded and not large.
Member
|
Teuthology results (no regressions):
|
Member
|
@mheler and @mattbenjamin The tracker did not list any backports so this was marked as resolved. If backports are appropriate please fix the tracker. Thanks. |
4 of 14 tasks
4 of 14 tasks
Open
4 of 14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rgw/lc: optimize lifecycle processing for multiple rules
This PR improves lifecycle policy processing performance when multiple rules are configured on a bucket.
Summary:
Three optimizations that work together to reduce I/O and improve concurrency:
Prior to these changes on a bucket with 100K object (4MB in size) evenly distributed with 32 tags, and using a 32 rule lifecycle policy expiring per each tag we observed the following times:
After this PR, the time to run the lifecycle policy was significantly cut back and aligns more closely with baseline results of ~3m (3m8.733s) using a single rule lifecycle policy
Fixes: https://tracker.ceph.com/issues/73936
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.