From 87f25c6864c379d11185db06825538bd481e388c Mon Sep 17 00:00:00 2001 From: Roman Vasin Date: Fri, 13 May 2022 15:02:45 +0300 Subject: [PATCH] Added thread_factor = 2 constant for initial value calculation of global_max_threads --- programs/server/Server.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index 7ebe52acf6f..22f01cb6869 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -1112,8 +1112,10 @@ int Server::main(const std::vector & /*args*/) auto global_max_threads = config->getInt("global_max_threads", 0); LOG_DEBUG(adqm_log,"From config.xml global_max_threads: {}", global_max_threads); if (global_max_threads == -1) { + // Based on tests global_max_threads has an optimal value when it's about two times of logical CPU cores + constexpr size_t thread_factor = 2; LOG_DEBUG(adqm_log,"number of logical cores: {}", std::thread::hardware_concurrency()); - global_max_threads = std::thread::hardware_concurrency()*2; + global_max_threads = std::thread::hardware_concurrency()*thread_factor; } LOG_DEBUG(adqm_log,"Finally global_max_threads: {}", global_max_threads); global_context->getProcessList().setGlobalMaxThreads(global_max_threads);