diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg index 07a5fddda211085ac4fd4a31217de523b67466dc..4cc871c0b1ed2ecff9a67d20fefc56ebad2df64c 100644 --- a/packaging/cfg/taos.cfg +++ b/packaging/cfg/taos.cfg @@ -30,10 +30,11 @@ # numOfThreadsPerCore 1.0 # the proportion of total CPU cores available for query processing -# 1.0: all CPU cores are available for query processing -# 0.5: only half of the CPU cores are available for query -# 0.0: only one core available -# ratioOfQueryThreads 1.0 +# 2.0: the query threads will be set to double of the CPU cores. +# 1.0: all CPU cores are available for query processing [default]. +# 0.5: only half of the CPU cores are available for query. +# 0.0: only one core available. +# tsRatioOfQueryCores 1.0 # number of management nodes in the system # numOfMnodes 3 diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index f17176fe986598d20b01aa652cdf1e04da2cb582..db15bb8964d93df25876d0ff15f96560abc6689d 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -46,7 +46,7 @@ extern int32_t tsShellActivityTimer; extern uint32_t tsMaxTmrCtrl; extern float tsNumOfThreadsPerCore; extern int32_t tsNumOfCommitThreads; -extern float tsRatioOfQueryThreads; +extern float tsRatioOfQueryCores; extern int8_t tsDaylight; extern char tsTimezone[]; extern char tsLocale[]; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index b5bc3fb143c4a03ff80f44bcc6dd92c4d268f435..cadad3c5d88ffd63e3a9fed098083423b1c1b2be 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -52,7 +52,7 @@ int32_t tsMaxConnections = 5000; int32_t tsShellActivityTimer = 3; // second float tsNumOfThreadsPerCore = 1.0f; int32_t tsNumOfCommitThreads = 1; -float tsRatioOfQueryThreads = 1.0f; +float tsRatioOfQueryCores = 1.0f; int8_t tsDaylight = 0; char tsTimezone[TSDB_TIMEZONE_LEN] = {0}; char tsLocale[TSDB_LOCALE_LEN] = {0}; @@ -444,12 +444,12 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); - cfg.option = "ratioOfQueryThreads"; - cfg.ptr = &tsRatioOfQueryThreads; + cfg.option = "ratioOfQueryCores"; + cfg.ptr = &tsRatioOfQueryCores; cfg.valType = TAOS_CFG_VTYPE_FLOAT; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; - cfg.minValue = 0.1f; - cfg.maxValue = 0.9f; + cfg.minValue = 0.0f; + cfg.maxValue = 2.0f; cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); diff --git a/src/dnode/src/dnodeVRead.c b/src/dnode/src/dnodeVRead.c index 545f87fa426808af1d8fd47479055f78482ba84f..3f31e4937052d7a505031b4c8083ae1acd00bf6c 100644 --- a/src/dnode/src/dnodeVRead.c +++ b/src/dnode/src/dnodeVRead.c @@ -28,9 +28,12 @@ static SWorkerPool tsVFetchWP; int32_t dnodeInitVRead() { const int32_t maxFetchThreads = 4; + // calculate the available query thread + float threadsForQuery = MAX(tsNumOfCores * tsRatioOfQueryCores, 1); + tsVQueryWP.name = "vquery"; tsVQueryWP.workerFp = dnodeProcessReadQueue; - tsVQueryWP.min = tsNumOfCores * tsRatioOfQueryThreads; + tsVQueryWP.min = (int32_t) threadsForQuery; tsVQueryWP.max = tsVQueryWP.min; if (tWorkerInit(&tsVQueryWP) != 0) return -1;