From: Mohit Agrawal Date: Thu, 23 Jan 2025 14:34:25 +0000 (+0530) Subject: crimson: Provide an options to configure several seastar parameters X-Git-Tag: v20.0.0~3^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ba7cc3b52602d6006e69a69f1e2165d9999ed35a;p=ceph.git crimson: Provide an options to configure several seastar parameters Implement a new mechanism to introduce a new seastar parameter in future and add options to configure parameters like task_quota_ms, io_latency_goal_ms and idle_poll_time_us. Fixes: https://tracker.ceph.com/issues/69595 Signed-off-by: Mohit Agrawal --- diff --git a/src/common/options/crimson.yaml.in b/src/common/options/crimson.yaml.in index 132a4a09e89..c8b4adacf76 100644 --- a/src/common/options/crimson.yaml.in +++ b/src/common/options/crimson.yaml.in @@ -51,6 +51,35 @@ options: - startup min: 0 max: 32 +- name: crimson_reactor_task_quota_ms + type: float + level: advanced + default: 0.5 + desc: The maximum time (ms) Seastar reactors will wait between polls. + long_desc: The maximum time (ms) Seastar reactors will wait between polls. + Shorter time between pools will result in larger CPU utilization. + flags: + - startup +- name: crimson_reactor_idle_poll_time_us + type: uint + level: advanced + default: 200 + desc: Seastar's reactor idle polling time (ms) before going back to sleep. + long_desc: Seastar's reactor idle polling time (ms) before going back to sleep. + Longer reactor poll time will result in larger CPU utilization. + flags: + - startup +- name: crimson_reactor_io_latency_goal_ms + type: float + level: advanced + default: 0 + desc: The maximum time (ms) Seastar's reactor IO operations must take. + If not set(0 mean not set), defaults to 1.5 * crimson_reactor_task_quota_ms + long_desc: The maximum time (ms) Seastar's reactor IO operations must take. + If not set, defaults to 1.5 * crimson_reactor_task_quota_ms. + Increasing this value will allow more IO requests to be dispatched concurrently. + flags: + - startup - name: crimson_osd_stat_interval type: int level: advanced diff --git a/src/crimson/osd/main_config_bootstrap_helpers.cc b/src/crimson/osd/main_config_bootstrap_helpers.cc index e4920eb870f..a76bce3d16c 100644 --- a/src/crimson/osd/main_config_bootstrap_helpers.cc +++ b/src/crimson/osd/main_config_bootstrap_helpers.cc @@ -84,6 +84,41 @@ seastar::future<> populate_config_from_mon() }); } +struct SeastarOption { + std::string option_name; // Command-line option name + std::string config_key; // Configuration key + Option::type_t value_type ; // Type of configuration value +}; + +// Define a list of Seastar options +const std::vector seastar_options = { + {"--task-quota-ms", "crimson_reactor_task_quota_ms", Option::TYPE_FLOAT}, + {"--io-latency-goal-ms", "crimson_reactor_io_latency_goal_ms", Option::TYPE_FLOAT}, + {"--idle-poll-time-us", "crimson_reactor_idle_poll_time_us", Option::TYPE_UINT} +}; + +// Function to get the option value as a string +std::optional get_option_value(const SeastarOption& option) { + switch (option.value_type) { + case Option::TYPE_FLOAT: { + if (auto value = crimson::common::get_conf(option.config_key)) { + return std::to_string(value); + } + break; + } + case Option::TYPE_UINT: { + if (auto value = crimson::common::get_conf(option.config_key)) { + return std::to_string(value); + } + break; + } + default: + logger().warn("get_option_value --option_name {} encountered unknown type", option.config_key); + return std::nullopt; + } + return std::nullopt; +} + static tl::expected _get_early_config(int argc, const char *argv[]) { @@ -143,6 +178,14 @@ _get_early_config(int argc, const char *argv[]) std::begin(early_args), std::end(early_args)); + for (const auto& option : seastar_options) { + auto option_value = get_option_value(option); + if (option_value) { + logger().info("Configure option_name {} with value : {}", option.config_key, option_value); + ret.early_args.emplace_back(option.option_name); + ret.early_args.emplace_back(*option_value); + } + } if (auto found = std::find_if( std::begin(early_args), std::end(early_args),