Added thread_factor = 2 constant for initial value calculation of global_max_threads

This commit is contained in:
Roman Vasin 2022-05-13 15:02:45 +03:00
parent d94e9c4263
commit 87f25c6864

View File

@ -1112,8 +1112,10 @@ int Server::main(const std::vector<std::string> & /*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);