master
c 18 lines 739 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #include "netdata-conf-cloud.h"
4 #include "../common.h"
5
6 size_t netdata_conf_cloud_query_threads(void) {
7 size_t cpus = MIN(netdata_conf_cpus(), 256); // max 256 cores
8 size_t threads = MIN(cpus * (netdata_conf_is_parent() ? 2 : 1), (size_t)libuv_worker_threads / 2);
9 threads = MAX(threads, 6);
10
11 threads = inicfg_get_number(&netdata_config, CONFIG_SECTION_CLOUD, "query threads", threads);
12 if(threads < 1) {
13 netdata_log_error("[" CONFIG_SECTION_CLOUD "].query threads in netdata.conf needs to be at least 1. Overwriting it.");
14 threads = 1;
15 inicfg_set_number(&netdata_config, CONFIG_SECTION_CLOUD, "query threads", threads);
16 }
17 return threads;
18 }