Skip to content

common/async: add primitives for structured concurrency with optional_yield - #57188

Merged
cbodley merged 5 commits into
ceph:mainfrom
cbodley:wip-boost-asio-yield-group
May 23, 2024
Merged

cbodley merged 5 commits into
ceph:mainfrom
cbodley:wip-boost-asio-yield-group

Conversation

@cbodley

@cbodley cbodley commented Apr 30, 2024 •

Copy link
Copy Markdown
Contributor

(based on feature branch wip-boost-asio-spawn from #55592)

adds spawn_throttle class for bounded concurrency with stackful coroutines from boost::asio::spawn(). this relies on new support for per-op cancellation to guarantee that the lifetime of child coroutines won't exceed the lifetime of their throttle, making it safe for children to access memory from their parent's stack

by taking optional_yield in the constructor, it transparently supports both synchronous execution (where optional_yield is empty) and asynchronous execution within a stackful coroutine (where optional_yield contains the parent's yield_context)

also adds a max_concurrent_for_each() algorithm (inspired by seastar) to hide the use of spawn_throttle

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@cbodley
cbodley requested review from adamemerson and ivancich April 30, 2024 20:55
@cbodley
cbodley force-pushed the wip-boost-asio-yield-group branch from 104e300 to 9179481 Compare April 30, 2024 21:26
@cbodley cbodley changed the title common/async: add yield_group for fork-join concurrency with optional_yield common/async: add primitives for structured concurrency with optional_yield May 9, 2024
@cbodley
cbodley force-pushed the wip-boost-asio-yield-group branch from 3c3600f to 5c390ae Compare May 9, 2024 18:18
@github-actions github-actions Bot added the rgw label May 9, 2024
@cbodley
cbodley force-pushed the wip-boost-asio-yield-group branch 3 times, most recently from e526a72 to d1cec20 Compare May 10, 2024 13:45
@cbodley
cbodley marked this pull request as ready for review May 10, 2024 14:46
@cbodley
cbodley requested a review from a team as a code owner May 10, 2024 14:46
@cbodley

cbodley commented May 10, 2024

Copy link
Copy Markdown
Contributor Author

@cfsnyder i used this spawn_throttle class to simplify RGWDeleteMultiObj. we now get concurrency in the null_yield case (where rgw_beast_enable_async=false) and no longer need the timer for wait_flush()

@cbodley

cbodley commented May 10, 2024

Copy link
Copy Markdown
Contributor Author

@cbodley

cbodley commented May 10, 2024

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@cbodley
cbodley force-pushed the wip-boost-asio-spawn branch from d448be7 to 79a6459 Compare May 13, 2024 17:24
@cbodley
cbodley requested a review from a team as a code owner May 13, 2024 17:24
@cbodley
cbodley force-pushed the wip-boost-asio-yield-group branch from d1cec20 to db12f04 Compare May 13, 2024 17:24
@cbodley
cbodley force-pushed the wip-boost-asio-yield-group branch from db12f04 to a05c668 Compare May 22, 2024 17:59
@cbodley
cbodley requested review from a team as code owners May 22, 2024 17:59
@cbodley
cbodley removed the request for review from a team May 22, 2024 17:59
@cbodley
cbodley requested review from aaSharma14 and afreen23 May 22, 2024 17:59
@cbodley
cbodley changed the base branch from wip-boost-asio-spawn to main May 22, 2024 17:59
@cbodley
cbodley removed request for a team, aaSharma14 and afreen23 May 22, 2024 17:59
@cbodley

cbodley commented May 22, 2024

Copy link
Copy Markdown
Contributor Author

sorry for the review spam, i had to change the base branch

Comment thread src/rgw/rgw_op.cc Resolved
…l_yield

a primitive for structured concurrency with stackful coroutines from
boost::asio::spawn(). this relies on spawn()'s support for per-op
cancellation to guarantee that the lifetime of child coroutines won't
exceed the lifetime of their spawn_throttle, making it safe for children
to access memory from their parent's stack

by taking optional_yield in the constructor, spawn_throttle transparently
supports synchronous execution (where optional_yield is empty) and
asynchronous execution within a stackful coroutine (where optional_yield
contains the parent's yield_context)

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

cbodley commented May 22, 2024

Copy link
Copy Markdown
Contributor Author

thanks @adamemerson. i decided to move the rgw stuff into #57641 so we can merge this one without qa

@cbodley

cbodley commented May 22, 2024

Copy link
Copy Markdown
Contributor Author

p.s. once #56499 merges, i'd also like to add an overload of max_concurrent_for_each() based on co_throttle

@cbodley

cbodley commented May 23, 2024

Copy link
Copy Markdown
Contributor Author

@cbodley

cbodley commented May 23, 2024

Copy link
Copy Markdown
Contributor Author

jenkins test api

@cbodley

cbodley commented May 23, 2024

Copy link
Copy Markdown
Contributor Author

jenkins test windows

inspired by seastar's max_concurrent_for_each(), implemented for
optional_yield in terms of yield_throttle

can also be overloaded for co_await() and co_throttle (not part of this
branch)

Signed-off-by: Casey Bodley <[email protected]>
@cbodley
cbodley force-pushed the wip-boost-asio-yield-group branch from c70623d to 25017d6 Compare May 23, 2024 13:06
@cbodley
cbodley merged commit 6ce969b into ceph:main May 23, 2024
@cbodley
cbodley deleted the wip-boost-asio-yield-group branch May 23, 2024 17:22
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Sep 25, 2026
Backport-Id: 01a0611b-47ce-7192-b2fc-daedac74c5c9
Backport-PR: #10
Upstream-PRs: ceph#61256, ceph#58229, ceph#57188
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 14, 2026
Backport-Id: 01a0611b-47ce-7192-b2fc-daedac74c5c9
Backport-PR: #10
Upstream-PRs: ceph#61256, ceph#58229, ceph#57188
uw-sc added a commit to cobaltcore-dev/ceph that referenced this pull request Oct 16, 2026
Backport-Id: 01a1443c-8dac-713b-90c4-9dd10156135c
Backport-PR: #34
Upstream-PRs: ceph#61256, ceph#58229, ceph#57188
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.

2 participants