Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharded.hh: add invoke_on variant for a shard range #2449

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

tomershafir
Copy link
Contributor

@tomershafir tomershafir commented Sep 21, 2024

Add a convenient method to invoke a function on a range of shards, to have better support for the cold control path on more complex compute models like shard groups for different tasks. A workload can benefit from such a model if inter-task cooperation is better when grouping from perf and QoS perspectives, for example. Or a computation requires a only a subset of shards due to internal concurrency limits.

@tomershafir tomershafir force-pushed the sharded-add-invoke-on-range branch 6 times, most recently from 6ce5244 to 29da27b Compare September 22, 2024 10:14
@@ -35,6 +35,8 @@
#include <boost/iterator/counting_iterator.hpp>
Copy link
Member

Choose a reason for hiding this comment

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

sharded.hh: add invoke_on variant for a shard range

Missing patch changelog

requires std::invocable<Func, Service&, Args...>
&& std::is_same_v<futurize_t<std::invoke_result_t<Func, Service&, internal::sharded_unwrap_t<Args>...>>, future<>>
future<>
invoke_on(unsigned begin, unsigned end, smp_submit_to_options options, Func func, Args... args) noexcept;
Copy link
Member

Choose a reason for hiding this comment

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

Better: pass a std::ranges::range of shards. Then any subset of the shards can be sent. If you want a contiguous range, use std::views::iota.

@tomershafir tomershafir force-pushed the sharded-add-invoke-on-range branch from 29da27b to a0f6802 Compare September 24, 2024 18:55
@tomershafir tomershafir marked this pull request as ready for review September 24, 2024 18:57
@tomershafir tomershafir force-pushed the sharded-add-invoke-on-range branch 5 times, most recently from 84d1bc9 to 5e046b9 Compare September 25, 2024 18:12
Add a convenient method to invoke a function on a range of shards, to have better support for the cold control path on more complex compute models like shard groups for different tasks. A workload can benefit from such a model if inter-task cooperation is better when grouping from perf and QoS perspectives, for example. Or a computation requires a only a subset of shards due to internal concurrency limits.
@tomershafir tomershafir force-pushed the sharded-add-invoke-on-range branch from 5e046b9 to 8c323e6 Compare September 28, 2024 12:43
@tomershafir
Copy link
Contributor Author

@avikivity changed to std::ranges::range

@avikivity avikivity merged commit b571539 into scylladb:master Sep 29, 2024
15 checks passed
@tomershafir tomershafir deleted the sharded-add-invoke-on-range branch September 29, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants