This is an automated email from the ASF dual-hosted git repository.

rong pushed a commit to branch rc/1.3.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rc/1.3.3 by this push:
     new 9a3c8e1e820 Active Load: Adjust the default execution thread to match 
the number of CPU cores (#13865) (#13872)
9a3c8e1e820 is described below

commit 9a3c8e1e82029abdf4458916806f3bfc48eae98a
Author: YC27 <[email protected]>
AuthorDate: Wed Oct 23 18:17:59 2024 +0800

    Active Load: Adjust the default execution thread to match the number of CPU 
cores (#13865) (#13872)
    
    (cherry picked from commit 574ba8ddd5753972305a2fc60f3cbad3f8085dda)
---
 .../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 bcc3cbea5be..09005321609 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
@@ -1174,7 +1174,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 b590864fd25..cfc2bf1c04a 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
@@ -2309,19 +2309,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 29f39ef8c72..3e14cc55b9f 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
@@ -1927,10 +1927,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.

Reply via email to