You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2024/10/22 10:03:42 UTC
(iotdb) branch master updated: Active Load: Adjust the default execution thread to match the number of CPU cores (#13865)
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 574ba8ddd57 Active Load: Adjust the default execution thread to match the number of CPU cores (#13865)
574ba8ddd57 is described below
commit 574ba8ddd5753972305a2fc60f3cbad3f8085dda
Author: YC27 <76...@users.noreply.github.com>
AuthorDate: Tue Oct 22 18:03:36 2024 +0800
Active Load: Adjust the default execution thread to match the number of CPU cores (#13865)
---
.../main/java/org/apache/iotdb/db/conf/IoTDBConfig.java | 2 +-
.../java/org/apache/iotdb/db/conf/IoTDBDescriptor.java | 16 ++++++----------
.../resources/conf/iotdb-system.properties.template | 4 ++--
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index 2dddbd3318d..eb046f03989 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -1199,7 +1199,7 @@ public class IoTDBConfig {
private long loadActiveListeningCheckIntervalSeconds = 5L;
- private int loadActiveListeningMaxThreadNum = 8;
+ private int loadActiveListeningMaxThreadNum = Runtime.getRuntime().availableProcessors();
/** Pipe related */
/** initialized as empty, updated based on the latest `systemDir` during querying */
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index f45025a2ad0..3376a413239 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -2357,19 +2357,15 @@ public class IoTDBDescriptor {
? conf.getLoadActiveListeningCheckIntervalSeconds()
: loadActiveListeningCheckIntervalSeconds);
- final int defaultLoadActiveListeningMaxThreadNum =
- Math.min(
- conf.getLoadActiveListeningMaxThreadNum(),
- Math.max(1, Runtime.getRuntime().availableProcessors() / 2));
- final int loadActiveListeningMaxThreadNum =
+ conf.setLoadActiveListeningMaxThreadNum(
Integer.parseInt(
properties.getProperty(
"load_active_listening_max_thread_num",
- Integer.toString(defaultLoadActiveListeningMaxThreadNum)));
- conf.setLoadActiveListeningMaxThreadNum(
- loadActiveListeningMaxThreadNum <= 0
- ? defaultLoadActiveListeningMaxThreadNum
- : loadActiveListeningMaxThreadNum);
+ Integer.toString(conf.getLoadActiveListeningMaxThreadNum()))));
+
+ if (conf.getLoadActiveListeningMaxThreadNum() <= 0) {
+ conf.setLoadActiveListeningMaxThreadNum(Runtime.getRuntime().availableProcessors());
+ }
}
private void loadLoadTsFileHotModifiedProp(Properties properties) throws IOException {
diff --git a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
index 5e61fa8926f..531891e456d 100644
--- a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
+++ b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
@@ -1949,10 +1949,10 @@ load_active_listening_dirs=ext/load/pending
load_active_listening_fail_dir=ext/load/failed
# The maximum number of threads that can be used to load tsfile actively.
-# The default value, when this parameter is commented out, is the minimum of 8 or the number of CPU cores.
+# The default value, when this parameter is commented out or <= 0, use CPU core number.
# effectiveMode: restart
# Datatype: int
-load_active_listening_max_thread_num=8
+load_active_listening_max_thread_num=0
# The interval specified in seconds for the active listening mode to check the directory specified in load_active_listening_dirs.
# The active listening mode will check the directory every load_active_listening_check_interval_seconds seconds.