Skip to content

Commit

Permalink
Add fetch scheduling group
Browse files Browse the repository at this point in the history
This scheduling group is used for consumer fetch processing. We assign
it the same priority as the default group (where most other kafka
handling takes place), but by putting it into its own group we prevent
non-fetch requests from being significantly delayed when fetch requests
use all the CPU.

Issue redpanda-data/core-internal#435
  • Loading branch information
travisdowns committed Apr 26, 2023
1 parent 1ceb333 commit d89da57
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/v/resource_mgmt/cpu_scheduling.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class scheduling_groups final {
"archival_upload", 100);
_node_status = co_await ss::create_scheduling_group("node_status", 50);
_self_test = co_await ss::create_scheduling_group("self_test", 100);
_fetch = co_await ss::create_scheduling_group("fetch", 1000);
}

ss::future<> destroy_groups() {
Expand All @@ -52,6 +53,7 @@ class scheduling_groups final {
co_await destroy_scheduling_group(_archival_upload);
co_await destroy_scheduling_group(_node_status);
co_await destroy_scheduling_group(_self_test);
co_await destroy_scheduling_group(_fetch);
co_return;
}

Expand All @@ -70,6 +72,16 @@ class scheduling_groups final {
ss::scheduling_group archival_upload() { return _archival_upload; }
ss::scheduling_group node_status() { return _node_status; }
ss::scheduling_group self_test_sg() { return _self_test; }
/**
* @brief Scheduling group for fetch requests.
*
* This scheduling group is used for consumer fetch processing. We assign
* it the same priority as the default group (where most other kafka
* handling takes place), but by putting it into its own group we prevent
* non-fetch requests from being significantly delayed when fetch requests
* use all the CPU.
*/
ss::scheduling_group fetch_sg() { return _fetch; }

std::vector<std::reference_wrapper<const ss::scheduling_group>>
all_scheduling_groups() const {
Expand All @@ -85,7 +97,8 @@ class scheduling_groups final {
std::cref(_raft_learner_recovery),
std::cref(_archival_upload),
std::cref(_node_status),
std::cref(_self_test)};
std::cref(_self_test),
std::cref(_fetch)};
}

private:
Expand All @@ -102,4 +115,5 @@ class scheduling_groups final {
ss::scheduling_group _archival_upload;
ss::scheduling_group _node_status;
ss::scheduling_group _self_test;
ss::scheduling_group _fetch;
};

0 comments on commit d89da57

Please sign in to comment.