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);