-
Notifications
You must be signed in to change notification settings - Fork 602
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
Process kafka requests in a separate scheduling group #24973
base: dev
Are you sure you want to change the base?
Changes from all commits
01b6b4d
01d654b
cf767f8
44c7696
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,7 @@ server::server( | |
ss::smp_service_group smp, | ||
ss::scheduling_group fetch_sg, | ||
ss::scheduling_group produce_sg, | ||
ss::scheduling_group handler_sg, | ||
ss::sharded<cluster::metadata_cache>& meta, | ||
ss::sharded<cluster::topics_frontend>& tf, | ||
ss::sharded<cluster::config_frontend>& cf, | ||
|
@@ -147,6 +148,7 @@ server::server( | |
, _smp_group(smp) | ||
, _fetch_scheduling_group(fetch_sg) | ||
, _produce_scheduling_group(produce_sg) | ||
, _request_handler_scheduling_group(handler_sg) | ||
, _topics_frontend(tf) | ||
, _config_frontend(cf) | ||
, _feature_table(ft) | ||
|
@@ -236,10 +238,26 @@ ss::scheduling_group server::produce_scheduling_group() const { | |
: ss::default_scheduling_group(); | ||
} | ||
|
||
ss::scheduling_group server::get_request_handler_sg() const { | ||
return config::shard_local_cfg().use_kafka_handler_scheduler_group() | ||
? _request_handler_scheduling_group | ||
: ss::default_scheduling_group(); | ||
} | ||
|
||
coordinator_ntp_mapper& server::coordinator_mapper() { | ||
return _group_router.local().coordinator_mapper().local(); | ||
} | ||
|
||
ss::scheduling_group server::get_request_scheduling_group(api_key key) const { | ||
if (key == produce_request::api_type::key) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this kind of stuff usually we want to add a handler method I think, rather than having the kafka server know anything about the different keys. E.g., a get_request_sg() method on the generic handler which returns the group (or none/default) to use? Is the problem that the handlers shouldn't access config? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good point, i will change that |
||
return produce_scheduling_group(); | ||
} | ||
if (key == fetch_request::api_type::key) { | ||
return fetch_scheduling_group(); | ||
} | ||
return get_request_handler_sg(); | ||
} | ||
|
||
config::broker_authn_method get_authn_method(const net::connection& conn) { | ||
// If authn_method is set on the endpoint | ||
// Use it | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@travisdowns related to the discussion from yesterday, does this even allocate the coroutine frame if
await_ready
returns true (because we are already in the right group - ignoring for a second whether we actually are here or not)? I thought not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which coroutine do you refer to? In any case there shouldn't be a coroutine frame allocated per switch_to, whether the switch happens or not. What
await_ready
returning true does is avoids an unnecessary task switch (which is probably more expensive even than a coro frame in "micro" costs, and certainly in macro costs as it breaks out of the current executing request, etc).