Skip to content

Commit

Permalink
Make the fetch scheduling group configurable
Browse files Browse the repository at this point in the history
Introduce a config tunable which would let users set the scheduling
group to use for kafka fetch request back to the default group.

Also useful for quick A/B testing of the perf effect of the change.
  • Loading branch information
travisdowns committed Apr 27, 2023
1 parent 9a93a9c commit bc72f5e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/v/config/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ configuration::configuration()
"Maximum number of bytes returned in fetch request",
{.needs_restart = needs_restart::no, .visibility = visibility::user},
55_MiB)
, use_fetch_scheduler_group(
*this,
"use_fetch_scheduler_group",
"Use a separate scheduler group for fetch processing",
{.needs_restart = needs_restart::no, .visibility = visibility::tunable},
true)
, metadata_status_wait_timeout_ms(
*this,
"metadata_status_wait_timeout_ms",
Expand Down
1 change: 1 addition & 0 deletions src/v/config/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ struct configuration final : public config_store {
enum_property<model::timestamp_type> log_message_timestamp_type;
enum_property<model::compression> log_compression_type;
property<size_t> fetch_max_bytes;
property<bool> use_fetch_scheduler_group;
property<std::chrono::milliseconds> metadata_status_wait_timeout_ms;
bounded_property<std::optional<int64_t>> kafka_connection_rate_limit;
property<std::vector<ss::sstring>> kafka_connection_rate_limit_overrides;
Expand Down
6 changes: 6 additions & 0 deletions src/v/kafka/server/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ server::server(
_probe.setup_public_metrics();
}

ss::scheduling_group server::fetch_scheduling_group() const {
return config::shard_local_cfg().use_fetch_scheduler_group()
? _fetch_scheduling_group
: ss::default_scheduling_group();
}

coordinator_ntp_mapper& server::coordinator_mapper() {
return _group_router.local().coordinator_mapper().local();
}
Expand Down
13 changes: 10 additions & 3 deletions src/v/kafka/server/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ class server final : public net::server {
ss::future<> apply(ss::lw_shared_ptr<net::connection>) final;

ss::smp_service_group smp_group() const { return _smp_group; }
ss::scheduling_group fetch_scheduling_group() const {
return _fetch_scheduling_group;
}

/**
* @brief Return the scheduling group to use for fetch requests.
*
* By default, fetches use a dedicated scheduling group, but this may
* be changed by configuration to restore the old behavior of lumping
* them with most other tasks in the default scheduling group.
*/
ss::scheduling_group fetch_scheduling_group() const;

cluster::topics_frontend& topics_frontend() {
return _topics_frontend.local();
}
Expand Down

0 comments on commit bc72f5e

Please sign in to comment.