Skip to content

Commit

Permalink
Active Load: Adjust the default execution thread to match the number …
Browse files Browse the repository at this point in the history
…of CPU cores (#13865)
  • Loading branch information
YC27 authored Oct 22, 2024
1 parent aea9f3a commit 574ba8d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2357,19 +2357,15 @@ private void loadLoadTsFileProps(Properties properties) {
? 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 574ba8d

Please sign in to comment.