Merge pull request #353 from yx-zhang/configMaxCon

add max concurrent client number
This commit is contained in:
Jialin Qiao 2019-08-25 21:33:39 +08:00 committed by GitHub
commit 719e87eff2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 1 deletions

View File

@ -27,6 +27,8 @@ rpc_port=6667
rpc_thrift_compression_enable=false rpc_thrift_compression_enable=false
rpc_max_concurrent_client_num=65535
#################### ####################
### Dynamic Parameter Adapter Configuration ### Dynamic Parameter Adapter Configuration
#################### ####################

View File

@ -48,6 +48,11 @@ public class IoTDBConfig {
*/ */
private int rpcPort = 6667; private int rpcPort = 6667;
/**
* Max concurrent client number
*/
private int maxConcurrentClientNum = 65535;
/** /**
* Memory allocated for the read process * Memory allocated for the read process
*/ */
@ -470,6 +475,14 @@ public class IoTDBConfig {
this.enableStatMonitor = enableStatMonitor; this.enableStatMonitor = enableStatMonitor;
} }
public int getMaxConcurrentClientNum() {
return maxConcurrentClientNum;
}
public void setMaxConcurrentClientNum(int maxConcurrentClientNum) {
this.maxConcurrentClientNum = maxConcurrentClientNum;
}
public int getStatMonitorDetectFreqSec() { public int getStatMonitorDetectFreqSec() {
return statMonitorDetectFreqSec; return statMonitorDetectFreqSec;
} }

View File

@ -241,6 +241,15 @@ public class IoTDBDescriptor {
conf.setPerformanceStatMemoryInKB(Integer conf.setPerformanceStatMemoryInKB(Integer
.parseInt(properties.getProperty("performance_stat_memory_in_kb", .parseInt(properties.getProperty("performance_stat_memory_in_kb",
Integer.toString(conf.getPerformanceStatMemoryInKB())).trim())); 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) { } catch (IOException e) {
logger.warn("Cannot load config file because, use default configuration", e); logger.warn("Cannot load config file because, use default configuration", e);
} catch (Exception e) { } catch (Exception e) {

View File

@ -210,7 +210,8 @@ public class JDBCService implements JDBCServiceMBean, IService {
IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig(); IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
serverTransport = new TServerSocket(new InetSocketAddress(config.getRpcAddress(), serverTransport = new TServerSocket(new InetSocketAddress(config.getRpcAddress(),
config.getRpcPort())); config.getRpcPort()));
poolArgs = new TThreadPoolServer.Args(serverTransport); poolArgs = new TThreadPoolServer.Args(serverTransport).maxWorkerThreads(IoTDBDescriptor.
getInstance().getConfig().getMaxConcurrentClientNum()).minWorkerThreads(1);
poolArgs.executorService = IoTDBThreadPoolFactory.createThriftRpcClientThreadPool(poolArgs, poolArgs.executorService = IoTDBThreadPoolFactory.createThriftRpcClientThreadPool(poolArgs,
ThreadName.JDBC_CLIENT.getName()); ThreadName.JDBC_CLIENT.getName());
poolArgs.processor(processor); poolArgs.processor(processor);