]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: Provide an options to configure several seastar parameters 61494/head
authorMohit Agrawal <moagrawa@redhat.com>
Thu, 23 Jan 2025 14:34:25 +0000 (20:04 +0530)
committerMohit Agrawal <moagrawa@redhat.com>
Sun, 16 Feb 2025 13:26:16 +0000 (18:56 +0530)
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 <moagrawa@redhat.com>
src/common/options/crimson.yaml.in
src/crimson/osd/main_config_bootstrap_helpers.cc

index 132a4a09e8928b119b21e2a2088b60ece8222601..c8b4adacf76ab506bc129e9c1116b238f1e5e2bc 100644 (file)
@@ -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
index e4920eb870f386ec9bbf18d7f1033641414f5929..a76bce3d16c6a8292a95e7cd91ffef11e8791b5f 100644 (file)
@@ -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<SeastarOption> 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<std::string> get_option_value(const SeastarOption& option) {
+  switch (option.value_type) {
+    case Option::TYPE_FLOAT: {
+      if (auto value = crimson::common::get_conf<double>(option.config_key)) {
+        return std::to_string(value);
+      }
+      break;
+    }
+    case Option::TYPE_UINT: {
+      if (auto value = crimson::common::get_conf<uint64_t>(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<early_config_t, int>
 _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),