From ddecfdd73791a452c8b90724d2fabb8659f6796c Mon Sep 17 00:00:00 2001 From: xs0 Date: Wed, 1 Sep 2021 23:13:11 +0800 Subject: [PATCH] make net_thread_count adaptive --- src/observer/ob_srv_network_frame.cpp | 6 +++++- src/share/parameter/ob_parameter_seed.ipp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/observer/ob_srv_network_frame.cpp b/src/observer/ob_srv_network_frame.cpp index 80721e505c..45256469ce 100644 --- a/src/observer/ob_srv_network_frame.cpp +++ b/src/observer/ob_srv_network_frame.cpp @@ -56,7 +56,11 @@ int ObSrvNetworkFrame::init() const char* mysql_unix_path = "unix:run/mysql.sock"; const uint32_t rpc_port = static_cast(GCONF.rpc_port); ObNetOptions opts; - const int io_cnt = static_cast(GCONF.net_thread_count); + int io_cnt = static_cast(GCONF.net_thread_count); + // make net thread count adaptive + if (0 == io_cnt) { + io_cnt = max(6, get_cpu_num() / 8); + } const int hp_io_cnt = static_cast(GCONF.high_priority_net_thread_count); const bool use_easy_ma = hp_io_cnt > 0; opts.rpc_io_cnt_ = io_cnt; diff --git a/src/share/parameter/ob_parameter_seed.ipp b/src/share/parameter/ob_parameter_seed.ipp index 6873aba9d3..8cd8469a84 100644 --- a/src/share/parameter/ob_parameter_seed.ipp +++ b/src/share/parameter/ob_parameter_seed.ipp @@ -59,8 +59,8 @@ DEF_TIME(internal_sql_execute_timeout, OB_CLUSTER_PARAMETER, "30s", "[1000us, 10 "the number of microseconds an internal DML request is permitted to " "execute before it is terminated. Range: [1000us, 10m]", ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); -DEF_INT(net_thread_count, OB_CLUSTER_PARAMETER, "12", "[1,100]", - "the number of rpc/mysql I/O threads for Libeasy. Range: [1, 100] in integer", +DEF_INT(net_thread_count, OB_CLUSTER_PARAMETER, "0", "[0,128]", + "the number of rpc/mysql I/O threads for Libeasy. Range: [0, 128] in integer, 0 stands for max(6, CPU_NUM/8)", ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::STATIC_EFFECTIVE)); DEF_INT(high_priority_net_thread_count, OB_CLUSTER_PARAMETER, "0", "[0,100]", "the number of rpc I/O threads for high priority messages, 0 means set off. Range: [0, 100] in integer", -- GitLab