Skip to content

Commit cea11e2

Browse files
Leon-WTFfeiteng.wtf
andauthored
DRILL-8132: Improvement of RPC (#2464)
Co-authored-by: feiteng.wtf <feiteng.wtf@cainiao.com>
1 parent 20f6546 commit cea11e2

7 files changed

Lines changed: 23 additions & 17 deletions

File tree

exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public ControlClient(ControlConnectionConfig config, DrillbitEndpoint remoteEndp
5050
super(ControlRpcConfig.getMapping(config.getBootstrapContext().getConfig(),
5151
config.getBootstrapContext().getExecutor()),
5252
config.getAllocator().getAsByteBufAllocator(),
53-
config.getBootstrapContext().getBitLoopGroup(),
53+
config.getBootstrapContext().getControlLoopGroup(),
5454
RpcType.HANDSHAKE,
5555
BitControlHandshake.class,
5656
BitControlHandshake.PARSER);

exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public ControlServer(ControlConnectionConfig config, ConnectionManagerRegistry c
4141
super(ControlRpcConfig.getMapping(config.getBootstrapContext().getConfig(),
4242
config.getBootstrapContext().getExecutor()),
4343
config.getAllocator().getAsByteBufAllocator(),
44-
config.getBootstrapContext().getBitLoopGroup());
44+
config.getBootstrapContext().getControlLoopGroup());
4545
this.config = config;
4646
this.connectionRegistry = connectionRegistry;
4747
}

exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public DataClient(DrillbitEndpoint remoteEndpoint, DataConnectionConfig config,
5151
DataRpcConfig.getMapping(config.getBootstrapContext().getConfig(),
5252
config.getBootstrapContext().getExecutor()),
5353
config.getAllocator().getAsByteBufAllocator(),
54-
config.getBootstrapContext().getBitClientLoopGroup(),
54+
config.getBootstrapContext().getDataClientLoopGroup(),
5555
RpcType.HANDSHAKE,
5656
BitServerHandshake.class,
5757
BitServerHandshake.PARSER);

exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public DataServer(DataConnectionConfig config) {
4141
DataRpcConfig.getMapping(config.getBootstrapContext().getConfig(),
4242
config.getBootstrapContext().getExecutor()),
4343
config.getAllocator().getAsByteBufAllocator(),
44-
config.getBootstrapContext().getBitLoopGroup());
44+
config.getBootstrapContext().getDataServerLoopGroup());
4545
this.config = config;
4646
}
4747

exec/java-exec/src/main/java/org/apache/drill/exec/server/BootStrapContext.java

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ public class BootStrapContext implements AutoCloseable {
6363
private final DrillConfig config;
6464
private final CaseInsensitiveMap<OptionDefinition> definitions;
6565
private final AuthenticatorProvider authProvider;
66-
private final EventLoopGroup loop;
67-
private final EventLoopGroup loop2;
66+
private final EventLoopGroup controlLoopGroup;
67+
private final EventLoopGroup dataClientLoopGroup;
68+
private final EventLoopGroup dataServerLoopGroup;
6869
private final MetricRegistry metrics;
6970
private final BufferAllocator allocator;
7071
private final ScanResult classpathScan;
@@ -81,8 +82,9 @@ public BootStrapContext(DrillConfig config, CaseInsensitiveMap<OptionDefinition>
8182
this.hostName = getCanonicalHostName();
8283
login(config);
8384
this.authProvider = new AuthenticatorProviderImpl(config, classpathScan);
84-
this.loop = TransportCheck.createEventLoopGroup(config.getInt(ExecConstants.BIT_SERVER_RPC_THREADS), "BitServer-");
85-
this.loop2 = TransportCheck.createEventLoopGroup(config.getInt(ExecConstants.BIT_SERVER_RPC_THREADS), "BitClient-");
85+
this.controlLoopGroup = TransportCheck.createEventLoopGroup(config.getInt(ExecConstants.BIT_SERVER_RPC_THREADS), "Control-");
86+
this.dataClientLoopGroup = TransportCheck.createEventLoopGroup(config.getInt(ExecConstants.BIT_SERVER_RPC_THREADS), "DataClient-");
87+
this.dataServerLoopGroup = TransportCheck.createEventLoopGroup(config.getInt(ExecConstants.BIT_SERVER_RPC_THREADS), "DataServer-");
8688
// Note that metrics are stored in a static instance
8789
this.metrics = DrillMetrics.getRegistry();
8890
this.allocator = RootAllocatorFactory.newRoot(config);
@@ -195,12 +197,16 @@ public CaseInsensitiveMap<OptionDefinition> getDefinitions() {
195197
return definitions;
196198
}
197199

198-
public EventLoopGroup getBitLoopGroup() {
199-
return loop;
200+
public EventLoopGroup getControlLoopGroup() {
201+
return controlLoopGroup;
200202
}
201203

202-
public EventLoopGroup getBitClientLoopGroup() {
203-
return loop2;
204+
public EventLoopGroup getDataClientLoopGroup() {
205+
return dataClientLoopGroup;
206+
}
207+
208+
public EventLoopGroup getDataServerLoopGroup() {
209+
return dataClientLoopGroup;
204210
}
205211

206212
public MetricRegistry getMetrics() {
@@ -258,9 +264,9 @@ public void close() {
258264

259265
try {
260266
AutoCloseables.close(allocator, authProvider);
261-
shutdown(loop);
262-
shutdown(loop2);
263-
267+
shutdown(controlLoopGroup);
268+
shutdown(dataClientLoopGroup);
269+
shutdown(dataServerLoopGroup);
264270
} catch (final Exception e) {
265271
logger.error("Error while closing", e);
266272
}

exec/java-exec/src/main/java/org/apache/drill/exec/server/DrillbitContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public AliasRegistryProvider getAliasRegistryProvider() {
227227
public OAuthTokenProvider getoAuthTokenProvider() { return oAuthTokenProvider; }
228228

229229
public EventLoopGroup getBitLoopGroup() {
230-
return context.getBitLoopGroup();
230+
return context.getControlLoopGroup();
231231
}
232232

233233
public DataConnectionCreator getDataConnectionsPool() {

exec/java-exec/src/main/resources/drill-module.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ drill.exec: {
9191
count: 7200,
9292
delay: 500
9393
},
94-
threads: 10
94+
threads: 8
9595
memory: {
9696
control: {
9797
reservation: 0,

0 commit comments

Comments
 (0)