Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the number of task event loop configurable #24565

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class QueryManagerConfig
private int queryManagerExecutorPoolSize = 5;

private Duration remoteTaskMaxErrorDuration = new Duration(5, TimeUnit.MINUTES);
private int remoteTaskMaxCallbackThreads = 1000;
private int remoteTaskMaxCallbackThreads = Runtime.getRuntime().availableProcessors();

private String queryExecutionPolicy = "all-at-once";
private Duration queryMaxRunTime = new Duration(100, TimeUnit.DAYS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,7 @@ public class HttpRemoteTaskFactory
private final QueryManager queryManager;
private final DecayCounter taskUpdateRequestSize;
private final boolean taskUpdateSizeTrackingEnabled;
private final EventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(Runtime.getRuntime().availableProcessors(),
new ThreadFactoryBuilder().setNameFormat("task-event-loop-%s").setDaemon(true).build())
{
@Override
protected EventLoop newChild(Executor executor, Object... args)
{
return new SafeEventLoop(this, executor);
}
};
private final EventLoopGroup eventLoopGroup;

@Inject
public HttpRemoteTaskFactory(
Expand Down Expand Up @@ -182,6 +174,15 @@ else if (binaryTransportEnabled) {

this.taskUpdateRequestSize = new DecayCounter(ExponentialDecay.oneMinute());
this.taskUpdateSizeTrackingEnabled = taskConfig.isTaskUpdateSizeTrackingEnabled();
this.eventLoopGroup = new DefaultEventLoopGroup(config.getRemoteTaskMaxCallbackThreads(),
new ThreadFactoryBuilder().setNameFormat("task-event-loop-%s").setDaemon(true).build())
{
@Override
protected EventLoop newChild(Executor executor, Object... args)
{
return new SafeEventLoop(this, executor);
}
};
}

@Managed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void testDefaults()
.setQueryManagerExecutorPoolSize(5)
.setRemoteTaskMinErrorDuration(new Duration(5, TimeUnit.MINUTES))
.setRemoteTaskMaxErrorDuration(new Duration(5, TimeUnit.MINUTES))
.setRemoteTaskMaxCallbackThreads(1000)
.setRemoteTaskMaxCallbackThreads(Runtime.getRuntime().availableProcessors())
.setQueryExecutionPolicy("all-at-once")
.setQueryMaxRunTime(new Duration(100, TimeUnit.DAYS))
.setQueryMaxExecutionTime(new Duration(100, TimeUnit.DAYS))
Expand Down
Loading