Skip to content

Commit 8aa9829

Browse files
authored
Merge pull request ceph#61494 from mohit84/seastar_configure
crimson: Provide an options to configure several seastar parameters Reviewed-by: Matan Breizman <[email protected]>
2 parents 9297329 + ba7cc3b commit 8aa9829

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

src/common/options/crimson.yaml.in

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,35 @@ options:
5151
- startup
5252
min: 0
5353
max: 32
54+
- name: crimson_reactor_task_quota_ms
55+
type: float
56+
level: advanced
57+
default: 0.5
58+
desc: The maximum time (ms) Seastar reactors will wait between polls.
59+
long_desc: The maximum time (ms) Seastar reactors will wait between polls.
60+
Shorter time between pools will result in larger CPU utilization.
61+
flags:
62+
- startup
63+
- name: crimson_reactor_idle_poll_time_us
64+
type: uint
65+
level: advanced
66+
default: 200
67+
desc: Seastar's reactor idle polling time (ms) before going back to sleep.
68+
long_desc: Seastar's reactor idle polling time (ms) before going back to sleep.
69+
Longer reactor poll time will result in larger CPU utilization.
70+
flags:
71+
- startup
72+
- name: crimson_reactor_io_latency_goal_ms
73+
type: float
74+
level: advanced
75+
default: 0
76+
desc: The maximum time (ms) Seastar's reactor IO operations must take.
77+
If not set(0 mean not set), defaults to 1.5 * crimson_reactor_task_quota_ms
78+
long_desc: The maximum time (ms) Seastar's reactor IO operations must take.
79+
If not set, defaults to 1.5 * crimson_reactor_task_quota_ms.
80+
Increasing this value will allow more IO requests to be dispatched concurrently.
81+
flags:
82+
- startup
5483
- name: crimson_osd_stat_interval
5584
type: int
5685
level: advanced

src/crimson/osd/main_config_bootstrap_helpers.cc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,41 @@ seastar::future<> populate_config_from_mon()
8484
});
8585
}
8686

87+
struct SeastarOption {
88+
std::string option_name; // Command-line option name
89+
std::string config_key; // Configuration key
90+
Option::type_t value_type ; // Type of configuration value
91+
};
92+
93+
// Define a list of Seastar options
94+
const std::vector<SeastarOption> seastar_options = {
95+
{"--task-quota-ms", "crimson_reactor_task_quota_ms", Option::TYPE_FLOAT},
96+
{"--io-latency-goal-ms", "crimson_reactor_io_latency_goal_ms", Option::TYPE_FLOAT},
97+
{"--idle-poll-time-us", "crimson_reactor_idle_poll_time_us", Option::TYPE_UINT}
98+
};
99+
100+
// Function to get the option value as a string
101+
std::optional<std::string> get_option_value(const SeastarOption& option) {
102+
switch (option.value_type) {
103+
case Option::TYPE_FLOAT: {
104+
if (auto value = crimson::common::get_conf<double>(option.config_key)) {
105+
return std::to_string(value);
106+
}
107+
break;
108+
}
109+
case Option::TYPE_UINT: {
110+
if (auto value = crimson::common::get_conf<uint64_t>(option.config_key)) {
111+
return std::to_string(value);
112+
}
113+
break;
114+
}
115+
default:
116+
logger().warn("get_option_value --option_name {} encountered unknown type", option.config_key);
117+
return std::nullopt;
118+
}
119+
return std::nullopt;
120+
}
121+
87122
static tl::expected<early_config_t, int>
88123
_get_early_config(int argc, const char *argv[])
89124
{
@@ -143,6 +178,14 @@ _get_early_config(int argc, const char *argv[])
143178
std::begin(early_args),
144179
std::end(early_args));
145180

181+
for (const auto& option : seastar_options) {
182+
auto option_value = get_option_value(option);
183+
if (option_value) {
184+
logger().info("Configure option_name {} with value : {}", option.config_key, option_value);
185+
ret.early_args.emplace_back(option.option_name);
186+
ret.early_args.emplace_back(*option_value);
187+
}
188+
}
146189
if (auto found = std::find_if(
147190
std::begin(early_args),
148191
std::end(early_args),

0 commit comments

Comments
 (0)