diff --git a/server/src/assembly/resources/conf/iotdb-engine.properties b/server/src/assembly/resources/conf/iotdb-engine.properties index e8705739e77..c63c000b877 100644 --- a/server/src/assembly/resources/conf/iotdb-engine.properties +++ b/server/src/assembly/resources/conf/iotdb-engine.properties @@ -27,6 +27,8 @@ rpc_port=6667 rpc_thrift_compression_enable=false +rpc_max_concurrent_client_num=65535 + #################### ### Dynamic Parameter Adapter Configuration #################### 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 202b0c9a73e..85448a81573 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 @@ -48,6 +48,11 @@ public class IoTDBConfig { */ private int rpcPort = 6667; + /** + * Max concurrent client number + */ + private int maxConcurrentClientNum = 65535; + /** * Memory allocated for the read process */ @@ -470,6 +475,14 @@ public class IoTDBConfig { this.enableStatMonitor = enableStatMonitor; } + public int getMaxConcurrentClientNum() { + return maxConcurrentClientNum; + } + + public void setMaxConcurrentClientNum(int maxConcurrentClientNum) { + this.maxConcurrentClientNum = maxConcurrentClientNum; + } + public int getStatMonitorDetectFreqSec() { return statMonitorDetectFreqSec; } 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 c0b98498320..f3f416729c6 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 @@ -241,6 +241,15 @@ public class IoTDBDescriptor { conf.setPerformanceStatMemoryInKB(Integer .parseInt(properties.getProperty("performance_stat_memory_in_kb", Integer.toString(conf.getPerformanceStatMemoryInKB())).trim())); + + int maxConcurrentClientNum = Integer.parseInt(properties. + getProperty("max_concurrent_client_num", + Integer.toString(conf.getMaxConcurrentClientNum()).trim())); + if (maxConcurrentClientNum <= 0) { + maxConcurrentClientNum = 65535; + } + conf.setMaxConcurrentClientNum(maxConcurrentClientNum); + } catch (IOException e) { logger.warn("Cannot load config file because, use default configuration", e); } catch (Exception e) { diff --git a/server/src/main/java/org/apache/iotdb/db/service/JDBCService.java b/server/src/main/java/org/apache/iotdb/db/service/JDBCService.java index 132ddebd79a..45981f8d820 100644 --- a/server/src/main/java/org/apache/iotdb/db/service/JDBCService.java +++ b/server/src/main/java/org/apache/iotdb/db/service/JDBCService.java @@ -210,7 +210,8 @@ public class JDBCService implements JDBCServiceMBean, IService { IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig(); serverTransport = new TServerSocket(new InetSocketAddress(config.getRpcAddress(), config.getRpcPort())); - poolArgs = new TThreadPoolServer.Args(serverTransport); + poolArgs = new TThreadPoolServer.Args(serverTransport).maxWorkerThreads(IoTDBDescriptor. + getInstance().getConfig().getMaxConcurrentClientNum()).minWorkerThreads(1); poolArgs.executorService = IoTDBThreadPoolFactory.createThriftRpcClientThreadPool(poolArgs, ThreadName.JDBC_CLIENT.getName()); poolArgs.processor(processor);