You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/09/02 08:50:48 UTC
[iotdb] branch master updated: [IOTDB-4306] Make max number of clients for InternalService configurable (#7210)
This is an automated email from the ASF dual-hosted git repository.
jackietien 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 eef201614c [IOTDB-4306] Make max number of clients for InternalService configurable (#7210)
eef201614c is described below
commit eef201614c522aa23e93853b93dfa228a5465d6f
Author: Jackie Tien <ja...@gmail.com>
AuthorDate: Fri Sep 2 16:50:41 2022 +0800
[IOTDB-4306] Make max number of clients for InternalService configurable (#7210)
---
.../resources/conf/iotdb-datanode.properties | 9 ++++++++
.../iotdb/db/client/DataNodeClientPoolFactory.java | 12 +++++++++--
.../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 25 ++++++++++++++++++++++
.../org/apache/iotdb/db/conf/IoTDBDescriptor.java | 12 +++++++++++
4 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/server/src/assembly/resources/conf/iotdb-datanode.properties b/server/src/assembly/resources/conf/iotdb-datanode.properties
index 99afaf642d..9322914906 100644
--- a/server/src/assembly/resources/conf/iotdb-datanode.properties
+++ b/server/src/assembly/resources/conf/iotdb-datanode.properties
@@ -97,6 +97,15 @@ target_config_nodes=127.0.0.1:22277
# Datatype: int
# connection_timeout_ms=20000
+# The maximum number of clients that can be idle for a node's InternalService.
+# When the number of idle clients on a node exceeds this number, newly returned clients will be released
+# Datatype: int
+# core_connection_for_internal_service=100
+
+# The maximum number of clients that can be applied for a node's InternalService
+# Datatype: int
+# max_connection_for_internal_service=100
+
# selector thread (TAsyncClientManager) nums for async thread in a clientManager
# Datatype: int
# selector_thread_nums_of_client_manager=1
diff --git a/server/src/main/java/org/apache/iotdb/db/client/DataNodeClientPoolFactory.java b/server/src/main/java/org/apache/iotdb/db/client/DataNodeClientPoolFactory.java
index 8f3e0d1ae7..ec96021c74 100644
--- a/server/src/main/java/org/apache/iotdb/db/client/DataNodeClientPoolFactory.java
+++ b/server/src/main/java/org/apache/iotdb/db/client/DataNodeClientPoolFactory.java
@@ -74,7 +74,11 @@ public class DataNodeClientPoolFactory {
.setSelectorNumOfAsyncClientManager(conf.getSelectorNumOfClientManager())
.build(),
ThreadName.CONFIG_NODE_CLIENT_POOL_THREAD_NAME.getName()),
- new ClientPoolProperty.Builder<AsyncConfigNodeIServiceClient>().build().getConfig());
+ new ClientPoolProperty.Builder<AsyncConfigNodeIServiceClient>()
+ .setMaxIdleClientForEachNode(conf.getCoreConnectionForInternalService())
+ .setMaxTotalClientForEachNode(conf.getMaxConnectionForInternalService())
+ .build()
+ .getConfig());
}
}
@@ -91,7 +95,11 @@ public class DataNodeClientPoolFactory {
.setRpcThriftCompressionEnabled(conf.isRpcThriftCompressionEnable())
.setSelectorNumOfAsyncClientManager(conf.getSelectorNumOfClientManager())
.build()),
- new ClientPoolProperty.Builder<SyncDataNodeInternalServiceClient>().build().getConfig());
+ new ClientPoolProperty.Builder<SyncDataNodeInternalServiceClient>()
+ .setMaxIdleClientForEachNode(conf.getCoreConnectionForInternalService())
+ .setMaxTotalClientForEachNode(conf.getMaxConnectionForInternalService())
+ .build()
+ .getConfig());
}
}
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index 750d10ec3d..0b03d48010 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -910,6 +910,15 @@ public class IoTDBConfig {
/** Thrift socket and connection timeout between data node and config node. */
private int connectionTimeoutInMS = (int) TimeUnit.SECONDS.toMillis(20);
+ /** the maximum number of clients that can be applied for a node's InternalService */
+ private int maxConnectionForInternalService = 100;
+
+ /**
+ * the maximum number of clients that can be idle for a node's InternalService. When the number of
+ * idle clients on a node exceeds this number, newly returned clients will be released
+ */
+ private int coreConnectionForInternalService = 100;
+
/**
* ClientManager will have so many selector threads (TAsyncClientManager) to distribute to its
* clients.
@@ -2903,6 +2912,22 @@ public class IoTDBConfig {
this.connectionTimeoutInMS = connectionTimeoutInMS;
}
+ public int getMaxConnectionForInternalService() {
+ return maxConnectionForInternalService;
+ }
+
+ public void setMaxConnectionForInternalService(int maxConnectionForInternalService) {
+ this.maxConnectionForInternalService = maxConnectionForInternalService;
+ }
+
+ public int getCoreConnectionForInternalService() {
+ return coreConnectionForInternalService;
+ }
+
+ public void setCoreConnectionForInternalService(int coreConnectionForInternalService) {
+ this.coreConnectionForInternalService = coreConnectionForInternalService;
+ }
+
public int getSelectorNumOfClientManager() {
return selectorNumOfClientManager;
}
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index be8c9d2f53..ac3e7d55df 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -239,6 +239,18 @@ public class IoTDBDescriptor {
properties.getProperty(
"connection_timeout_ms", String.valueOf(conf.getConnectionTimeoutInMS()))));
+ conf.setMaxConnectionForInternalService(
+ Integer.parseInt(
+ properties.getProperty(
+ "max_connection_for_internal_service",
+ String.valueOf(conf.getMaxConnectionForInternalService()))));
+
+ conf.setCoreConnectionForInternalService(
+ Integer.parseInt(
+ properties.getProperty(
+ "core_connection_for_internal_service",
+ String.valueOf(conf.getCoreConnectionForInternalService()))));
+
conf.setSelectorNumOfClientManager(
Integer.parseInt(
properties.getProperty(