forked from redpanda-data/redpanda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resource_mgmt/smp: seperate implementation
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
- Loading branch information
Showing
3 changed files
with
73 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ v_cc_library( | |
memory_sampling.cc | ||
cpu_profiler.cc | ||
logger.cc | ||
smp_groups.cc | ||
DEPS | ||
Seastar::seastar | ||
v::ssx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright 2024 Redpanda Data, Inc. | ||
* | ||
* Use of this software is governed by the Business Source License | ||
* included in the file licenses/BSL.md | ||
* | ||
* As of the Change Date specified in that file, in accordance with | ||
* the Business Source License, use of this software will be governed | ||
* by the Apache License, Version 2.0 | ||
*/ | ||
|
||
#include "resource_mgmt/smp_groups.h" | ||
|
||
#include <seastar/core/coroutine.hh> | ||
|
||
ss::future<> smp_groups::create_groups(config cfg) { | ||
_raft = co_await create_service_group( | ||
cfg.raft_group_max_non_local_requests); | ||
_kafka = co_await create_service_group( | ||
cfg.kafka_group_max_non_local_requests); | ||
_cluster = co_await create_service_group( | ||
cfg.cluster_group_max_non_local_requests); | ||
_proxy = co_await create_service_group( | ||
cfg.proxy_group_max_non_local_requests); | ||
_transform = co_await create_service_group( | ||
cfg.transform_group_max_non_local_requests); | ||
} | ||
|
||
ss::future<> smp_groups::destroy_groups() { | ||
co_await destroy_smp_service_group(*_kafka); | ||
co_await destroy_smp_service_group(*_raft); | ||
co_await destroy_smp_service_group(*_cluster); | ||
co_await destroy_smp_service_group(*_proxy); | ||
co_await destroy_smp_service_group(*_transform); | ||
} | ||
|
||
uint32_t | ||
smp_groups::default_raft_non_local_requests(uint32_t max_partitions_per_core) { | ||
/** | ||
* raft max non local requests | ||
* - up to 7000 groups per core | ||
* - up to 256 concurrent append entries per group | ||
* - additional requests like (vote, snapshot, timeout now) | ||
* | ||
* All the values have to be multiplied by core count minus one since | ||
* part of the requests will be core local | ||
* | ||
* 7000*256 * (number of cores-1) + 10 * 7000 * (number of cores-1) | ||
* ^ ^ | ||
* append entries requests additional requests | ||
*/ | ||
|
||
static constexpr uint32_t max_append_requests_per_follower = 256; | ||
static constexpr uint32_t additional_requests_per_follower = 10; | ||
|
||
return max_partitions_per_core | ||
* (max_append_requests_per_follower + additional_requests_per_follower) | ||
* (ss::smp::count - 1); | ||
} | ||
|
||
ss::future<std::unique_ptr<ss::smp_service_group>> | ||
smp_groups::create_service_group(unsigned max_non_local_requests) { | ||
ss::smp_service_group_config smp_sg_config{ | ||
.max_nonlocal_requests = max_non_local_requests}; | ||
auto sg = co_await create_smp_service_group(smp_sg_config); | ||
co_return std::make_unique<ss::smp_service_group>(sg); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters