Skip to content

Commit c7d8d0a

Browse files
committed
make event loop thread number configurable
1 parent 99ea15b commit c7d8d0a

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

presto-main/src/main/java/com/facebook/presto/execution/QueryManagerConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class QueryManagerConfig
7070
private int queryManagerExecutorPoolSize = 5;
7171

7272
private Duration remoteTaskMaxErrorDuration = new Duration(5, TimeUnit.MINUTES);
73-
private int remoteTaskMaxCallbackThreads = 1000;
73+
private int remoteTaskMaxCallbackThreads = Runtime.getRuntime().availableProcessors();
7474

7575
private String queryExecutionPolicy = "all-at-once";
7676
private Duration queryMaxRunTime = new Duration(100, TimeUnit.DAYS);

presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTaskFactory.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,7 @@ public class HttpRemoteTaskFactory
9494
private final MetadataManager metadataManager;
9595
private final QueryManager queryManager;
9696
private final DecayCounter taskUpdateRequestSize;
97-
private final EventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(Runtime.getRuntime().availableProcessors(),
98-
new ThreadFactoryBuilder().setNameFormat("task-event-loop-%s").setDaemon(true).build())
99-
{
100-
@Override
101-
protected EventLoop newChild(Executor executor, Object... args)
102-
{
103-
return new SafeEventLoop(this, executor);
104-
}
105-
};
97+
private final EventLoopGroup eventLoopGroup;
10698

10799
@Inject
108100
public HttpRemoteTaskFactory(
@@ -180,6 +172,15 @@ else if (binaryTransportEnabled) {
180172
this.queryManager = queryManager;
181173

182174
this.taskUpdateRequestSize = new DecayCounter(ExponentialDecay.oneMinute());
175+
this.eventLoopGroup = new DefaultEventLoopGroup(config.getRemoteTaskMaxCallbackThreads(),
176+
new ThreadFactoryBuilder().setNameFormat("task-event-loop-%s").setDaemon(true).build())
177+
{
178+
@Override
179+
protected EventLoop newChild(Executor executor, Object... args)
180+
{
181+
return new SafeEventLoop(this, executor);
182+
}
183+
};
183184
}
184185

185186
@Managed

0 commit comments

Comments
 (0)