Skip to content

rgw/lc: replace WorkPool with ceph::async::spawn_throttle - #63762

Merged
cbodley merged 8 commits into
ceph:mainfrom
cbodley:wip-rgw-lc-wp-coro
Oct 22, 2025
Merged

cbodley merged 8 commits into
ceph:mainfrom
cbodley:wip-rgw-lc-wp-coro

Conversation

@cbodley

@cbodley cbodley commented Jun 5, 2025

Copy link
Copy Markdown
Contributor

use spawn_throttle to spawn the work functions as coroutines instead of passing WorkItems to separate WorkQ threads for processing. the spawn_throttle concurrency limit uses the same rgw_lc_max_wp_worker value that previously controlled the number of WorkQ threads

Show available Jenkins commands

@cbodley

cbodley commented Jun 12, 2025 •

Copy link
Copy Markdown
Contributor Author

@cbodley
cbodley force-pushed the wip-rgw-lc-wp-coro branch from 5db99f0 to eec3542 Compare June 13, 2025 14:17
@github-actions

github-actions Bot commented Jun 13, 2025 •

Copy link
Copy Markdown

Config Diff Tool Output

! changed: rgw_lc_max_wp_worker: old: Number of workpool threads per LCWorker (rgw.yaml.in)
! changed: rgw_lc_max_wp_worker: new: Number of workpool coroutines per LCWorker (rgw.yaml.in)
! changed: rgw_lc_max_wp_worker: old: 3 (rgw.yaml.in)
! changed: rgw_lc_max_wp_worker: new: 128 (rgw.yaml.in)
! changed: rgw_lc_max_wp_worker: old: This option specifies the number of threads in each lifecycle workers work pool. This option can help accelerate processing each bucket. (rgw.yaml.in)
! changed: rgw_lc_max_wp_worker: new: This option specifies the number of coroutines in each lifecycle workers work pool. This option can help accelerate processing each bucket. (rgw.yaml.in)
! changed: rgw_lc_max_wp_worker: old: Number of threads in per-LCWorker workpools--used to accelerate per-bucket processing (rgw.yaml.in)
! changed: rgw_lc_max_wp_worker: new: Number of coroutines in per-LCWorker workpools--used to accelerate per-bucket processing (rgw.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

@cbodley
cbodley marked this pull request as ready for review June 13, 2025 14:55
@cbodley
cbodley requested a review from a team as a code owner June 13, 2025 14:55
@cbodley

cbodley commented Jun 13, 2025

Copy link
Copy Markdown
Contributor Author

rebased, still passing s3tests for lifecycle_expiration

@adamemerson adamemerson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cbodley

cbodley commented Jun 16, 2025

Copy link
Copy Markdown
Contributor Author

sharing an update from Yixin via email:

Since last Wednesday, I tried to compare both Akamai proposed solution and the alternative proposed by Casey in term of the performance difference, here is what I have found so far.

Between

  1. Akamai solution configured with rgw_lc_max_wp_worker=3 (default) and rgw_lc_wp_worker_max_aio=128 (default), which translates to maximum concurrency 384 in each LCWorker thread
  2. Casey’s solution configured with rgw_lc_max_wp_worker=384 to match the concurrency level,

they perform about the same (within 2.5% difference) when ordered listing is used.

With default setting in Casey’s solution (rgw_lc_max_wp_worker=128), it performs 11% slower. It is expected to be slower but it seems to be economical with 1/3 concurrency and only 11% slower.

PS. The test is done with rgw lc debug interval = 10 and driven by radosgw-admin lc process.

@mattbenjamin mattbenjamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine to me

Comment thread src/common/options/rgw.yaml.in Resolved
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@cbodley

cbodley commented Jun 26, 2025

Copy link
Copy Markdown
Contributor Author

rebased over conflicts from #63179

@adamemerson

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@ivancich

ivancich commented Jul 7, 2025 •

Copy link
Copy Markdown
Member

@cbodley

cbodley commented Jul 7, 2025

Copy link
Copy Markdown
Contributor Author

@cbodley Since this pr also touches LC is there any connection?

looks like it, thanks

@cbodley cbodley removed the needs-qa label Jul 7, 2025
@cbodley

cbodley commented Jul 7, 2025

Copy link
Copy Markdown
Contributor Author

https://qa-proxy.ceph.com/teuthology/anuchaithra-2025-07-04_16:46:39-rgw-wip-anrao2-testing-2025-07-04-1031-distro-default-smithi/8369941/teuthology.log
https://qa-proxy.ceph.com/teuthology/anuchaithra-2025-07-04_16:46:39-rgw-wip-anrao2-testing-2025-07-04-1031-distro-default-smithi/8369941/remote/smithi190/log/rgw.ceph.client.0.log.gz

   -10> 2025-07-04T17:31:51.136+0000 7fb2972d0640  5 lifecycle: RGWLC::process() entry.bucket.empty() == true at START 1 (this is possible mainly before any lc policy has been stored or after removal of an lc_shard object)
    -9> 2025-07-04T17:31:51.137+0000 7fb2972d0640  5 lifecycle: RGWLC::process(): ENTER: index: 10 worker ix: 2
    -8> 2025-07-04T17:31:51.138+0000 7fb2972d0640  5 lifecycle: RGWLC::process() process shard rollover lc_shard=lc.10 head.marker= head.shard_rollover_date=1751650309
    -7> 2025-07-04T17:31:51.139+0000 7fb2972d0640  5 lifecycle: RGWLC::process(): START entry 1: <ent: bucket=:test-pyafgvvas8ma6pqscbeaj15k-470:36f82ef2-c21f-437a-a1ca-bb7eef4f0261.4249.486; start_time=Fri Jul  4 17:31:40 2025; status=COMPLETE> index: 10 worker ix: 2
    -6> 2025-07-04T17:31:51.141+0000 7fb2972d0640  5 lifecycle: RGWLC::process(): START entry 2: <ent: bucket=:test-pyafgvvas8ma6pqscbeaj15k-470:36f82ef2-c21f-437a-a1ca-bb7eef4f0261.4249.486; start_time=Fri Jul  4 17:31:51 2025; status=PROCESSING> index: 10 worker ix: 2
    -5> 2025-07-04T17:31:51.143+0000 7fb2972d0640  5 lifecycle: RGWLC::bucket_lc_process ENTER bucket=test-pyafgvvas8ma6pqscbeaj15k-470
    -4> 2025-07-04T17:31:51.159+0000 7fb2aeaff640 20 handle_completion(): completion ok for obj=test1/b[B04wZmyhBD0dna3GZxMC4Y8MunLz6Vq]
    -3> 2025-07-04T17:31:51.162+0000 7fb2aeaff640 20 handle_completion(): completion ok for obj=test1/a[cT9OMQKMUn-hvmz95anqU0WFCumBUX9]
    -2> 2025-07-04T17:31:51.164+0000 7fb2af300640 20 handle_completion(): completion ok for obj=test1/b[hlrgs1lVy8GlGqq4l8dzIOrlNouAlyc]
    -1> 2025-07-04T17:31:51.167+0000 7fb2aeaff640 20 handle_completion(): completion ok for obj=test1/a
     0> 2025-07-04T17:31:51.171+0000 7fb2972d0640 -1 *** Caught signal (Segmentation fault) **
 in thread 7fb2972d0640 thread_name:rgw_lc_2
   
 ceph version 20.3.0-1369-gd6d0b422 (d6d0b422bd2d500980459454053425de0f29315a) tentacle (dev - RelWithDebInfo)
 1: /lib64/libc.so.6(+0x3ea60) [0x7fb3bd83ea60]
 2: /lib64/libc.so.6(+0x16274d) [0x7fb3bd96274d]
 3: radosgw(+0x5132e8) [0x55afe01142e8]
 4: (std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)+0x194) [0x7fb3bdd3b004]
 5: radosgw(+0xd02136) [0x55afe0903136]
 6: radosgw(+0xd030ad) [0x55afe09040ad]
 7: (LCOpRule::process(rgw_bucket_dir_entry&, DoutPrefixProvider const*, optional_yield)+0x469) [0x55afe0904729]
 8: radosgw(+0xd1d43d) [0x55afe091e43d]
 9: radosgw(+0xd1d9c3) [0x55afe091e9c3]
 10: radosgw(+0x115fd0f) [0x55afe0d60d0f]

@cbodley

cbodley commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

i captured a failure with debug rgw lifecycle enabled in https://pulpito.ceph.com/cbodley-2025-09-15_13:20:30-rgw:lifecycle-wip-rgw-lc-wp-coro-distro-default-gibba/

test_lifecycle_expiration_newer_noncurrent() writes 10 object versions, sets a lifecycle policy, then waits for 2 lifecycle intervals before checking the expirations

in the radosgw log, i see lifecycle processing this bucket once:

2025-09-16T18:16:25.313+0000 7fccf4997640 5 lifecycle: RGWLC::bucket_lc_process ENTER bucket=test-31u3yqyhn04ndmnvndk32x9o-447

but the objects are only ~9.3 seconds old so aren't considered expired yet (because rgw lc debug interval: 10):

2025-09-16T18:16:25.313+0000 7fccf4997640 20 lifecycle: obj_has_expired(): mtime=2025-09-16T18:16:16.799714+0000 days=1 base_time=2025-09-16T18:16:25.317179+0000 timediff=9.31718 cmp=10 is_expired=0

during this interval, the other 2 worker threads visit this bucket again but skip it:

2025-09-16T18:16:25.337+0000 7fccf5198640 5 lifecycle: RGWLC::process() worker ix: 1 SKIP processing for already-processed bucket :test-31u3yqyhn04ndmnvndk32x9o-447:baadc157-95b8-4704-a47f-6c3e0f566d6b.4246.465
2025-09-16T18:16:25.417+0000 7fccf5999640 5 lifecycle: RGWLC::process() worker ix: 0 SKIP processing for already-processed bucket :test-31u3yqyhn04ndmnvndk32x9o-447:baadc157-95b8-4704-a47f-6c3e0f566d6b.4246.465

about 10 seconds after that, this bucket is visited again but skipped by all 3 workers:

2025-09-16T18:16:34.637+0000 7fccf5198640 5 lifecycle: RGWLC::process() worker ix: 1 SKIP processing for already-processed bucket :test-31u3yqyhn04ndmnvndk32x9o-447:baadc157-95b8-4704-a47f-6c3e0f566d6b.4246.465
2025-09-16T18:16:34.649+0000 7fccf4997640 5 lifecycle: RGWLC::process() worker ix: 2 SKIP processing for already-processed bucket :test-31u3yqyhn04ndmnvndk32x9o-447:baadc157-95b8-4704-a47f-6c3e0f566d6b.4246.465
2025-09-16T18:16:34.801+0000 7fccf5999640 5 lifecycle: RGWLC::process() worker ix: 0 SKIP processing for already-processed bucket :test-31u3yqyhn04ndmnvndk32x9o-447:baadc157-95b8-4704-a47f-6c3e0f566d6b.4246.465

because of this, none of the expirations expected by the test were applied

when first processed, the bucket's lc entry showed a start_time of 18:16:25 but the second interval visited and skipped the bucket at 18:16:34

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@cbodley

cbodley commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

rebased after merge of #65664. still waiting on #65585 for reliable testing

@cbodley

cbodley commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

kkeshava-akamai and others added 8 commits October 21, 2025 09:08
these were only used to log the WorkQ's thread name, which will no
longer be relevant with coroutines

Signed-off-by: Casey Bodley <[email protected]>
use spawn_throttle to spawn the work functions as coroutines instead of
passing WorkItems to separate WorkQ threads for processing. the
spawn_throttle concurrency limit uses the same rgw_lc_max_wp_worker
value that previously controlled the number of WorkQ threads

Signed-off-by: Casey Bodley <[email protected]>
avoid blocking operations in LCObjsLister under bucket_lc_process()
because it's serviced by a single thread

Signed-off-by: Casey Bodley <[email protected]>
now that the workers run as coroutines instead of threads, we can afford
to run several more workers per bucket

Signed-off-by: Casey Bodley <[email protected]>
lifecycle debug output was no longer showing up after the rgw_lifecycle
subsys split from rgw

Signed-off-by: Casey Bodley <[email protected]>
@cbodley

cbodley commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

@cbodley

cbodley commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@cbodley

cbodley commented Oct 22, 2025

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants