From cb75499e773889ff39e0e89efd9a8f8d65223e62 Mon Sep 17 00:00:00 2001 From: zhjc1124 Date: Tue, 12 Sep 2023 09:44:10 +0000 Subject: [PATCH] fix sys tenant backlog with cgroup on --- src/share/config/ob_server_config.cpp | 28 +++++++++++++++++++ src/share/config/ob_server_config.h | 4 +-- src/share/parameter/ob_parameter_seed.ipp | 8 +++--- .../ob_resource_plan_manager.cpp | 2 +- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/share/config/ob_server_config.cpp b/src/share/config/ob_server_config.cpp index 3c174aa0af..fee19e77bd 100644 --- a/src/share/config/ob_server_config.cpp +++ b/src/share/config/ob_server_config.cpp @@ -167,6 +167,34 @@ void ObServerConfig::print() const OB_LOG(INFO, "===================== *stop server config report* ======================="); } +double ObServerConfig::get_sys_tenant_default_min_cpu() +{ + double min_cpu = server_cpu_quota_min; + if (0 == min_cpu) { + int64_t cpu_count = get_cpu_count(); + if (cpu_count < 8) { + min_cpu = 1; + } else { + min_cpu = 2; + } + } + return min_cpu; +} + +double ObServerConfig::get_sys_tenant_default_max_cpu() +{ + double max_cpu = server_cpu_quota_min; + if (0 == max_cpu) { + int64_t cpu_count = get_cpu_count(); + if (cpu_count < 8) { + max_cpu = 1; + } else { + max_cpu = 2; + } + } + return max_cpu; +} + int ObServerConfig::deserialize_with_compat(const char *buf, const int64_t data_len, int64_t &pos) { int ret = OB_SUCCESS; diff --git a/src/share/config/ob_server_config.h b/src/share/config/ob_server_config.h index e8521b959e..72cd2f3674 100644 --- a/src/share/config/ob_server_config.h +++ b/src/share/config/ob_server_config.h @@ -80,8 +80,8 @@ public: // print all config to log file void print() const; - double get_sys_tenant_default_min_cpu() { return server_cpu_quota_min; } - double get_sys_tenant_default_max_cpu() { return server_cpu_quota_max; } + double get_sys_tenant_default_min_cpu(); + double get_sys_tenant_default_max_cpu(); virtual ObServerRole get_server_type() const { return common::OB_SERVER; } virtual bool is_debug_sync_enabled() const { return static_cast(debug_sync_timeout) > 0; } diff --git a/src/share/parameter/ob_parameter_seed.ipp b/src/share/parameter/ob_parameter_seed.ipp index 2125534347..ae0b0dc797 100755 --- a/src/share/parameter/ob_parameter_seed.ipp +++ b/src/share/parameter/ob_parameter_seed.ipp @@ -272,13 +272,13 @@ DEF_TIME_WITH_CHECKER(max_stale_time_for_weak_consistency, OB_TENANT_PARAMETER, DEF_BOOL(enable_monotonic_weak_read, OB_TENANT_PARAMETER, "false", "specifies observer supportting atomicity and monotonic order read", ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); -DEF_DBL(server_cpu_quota_min, OB_CLUSTER_PARAMETER, "1", "[1,16]", +DEF_DBL(server_cpu_quota_min, OB_CLUSTER_PARAMETER, "0", "[0,16]", "the number of minimal vCPUs allocated to the server tenant" - "(a special internal tenant that exists on every observer). Range: [1, 16]", + "(a special internal tenant that exists on every observer). 0 stands for adaptive. Range: [0, 16]", ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::STATIC_EFFECTIVE)); -DEF_DBL(server_cpu_quota_max, OB_CLUSTER_PARAMETER, "1", "[1,16]", +DEF_DBL(server_cpu_quota_max, OB_CLUSTER_PARAMETER, "0", "[0,16]", "the number of maximal vCPUs allocated to the server tenant" - "(a special internal tenant that exists on every observer). Range: [1, 16]", + "(a special internal tenant that exists on every observer). 0 stands for adaptive. Range: [0, 16]", ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::STATIC_EFFECTIVE)); DEF_CAP_WITH_CHECKER(_hidden_sys_tenant_memory, OB_CLUSTER_PARAMETER, "0M", common::ObConfigTenantMemoryChecker, "[0M,)", diff --git a/src/share/resource_manager/ob_resource_plan_manager.cpp b/src/share/resource_manager/ob_resource_plan_manager.cpp index f1d05bdc8b..a9aad3629c 100644 --- a/src/share/resource_manager/ob_resource_plan_manager.cpp +++ b/src/share/resource_manager/ob_resource_plan_manager.cpp @@ -192,7 +192,7 @@ int ObResourcePlanManager::normalize_cpu_directives(ObPlanDirectiveSet &directiv cfs_period_us))) { LOG_WARN("fail get cpu cfs period", K(d), K(ret)); } else { - if (d.utilization_limit_ == 100) { + if (is_sys_tenant(d.tenant_id_) || d.utilization_limit_ == 100) { // 不限制 d.utilization_limit_ = -1; } else {