Skip to content

Commit

Permalink
Configure worker threads relative to core count
Browse files Browse the repository at this point in the history
Worker threads defaults to 2*#cores. This commit allows configuration to
be #cores based too.

Extracted from trinodb#16303

Co-authored-by: Mateusz "Serafin" Gajewski <[email protected]>
  • Loading branch information
findepi and wendigo committed Feb 20, 2024
1 parent e5487b3 commit 28225f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ public int getMaxWorkerThreads()

@LegacyConfig("task.shard.max-threads")
@Config("task.max-worker-threads")
public TaskManagerConfig setMaxWorkerThreads(int maxWorkerThreads)
public TaskManagerConfig setMaxWorkerThreads(String maxWorkerThreads)
{
this.maxWorkerThreads = maxWorkerThreads;
this.maxWorkerThreads = ThreadCountParser.DEFAULT.parse(maxWorkerThreads);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void testDefaults()
.setTaskTerminationTimeout(new Duration(1, TimeUnit.MINUTES))
.setPerOperatorCpuTimerEnabled(true)
.setTaskCpuTimerEnabled(true)
.setMaxWorkerThreads(Runtime.getRuntime().availableProcessors() * 2)
.setMaxWorkerThreads("2C")
.setMinDrivers(Runtime.getRuntime().availableProcessors() * 2 * 2)
.setMinDriversPerTask(3)
.setMaxDriversPerTask(Integer.MAX_VALUE)
Expand Down Expand Up @@ -139,7 +139,7 @@ public void testExplicitPropertyMappings()
.setMaxPartialAggregationMemoryUsage(DataSize.of(32, Unit.MEGABYTE))
.setMaxPartialTopNMemory(DataSize.of(32, Unit.MEGABYTE))
.setMaxLocalExchangeBufferSize(DataSize.of(33, Unit.MEGABYTE))
.setMaxWorkerThreads(3)
.setMaxWorkerThreads("3")
.setMinDrivers(2)
.setMinDriversPerTask(5)
.setMaxDriversPerTask(13)
Expand Down

0 comments on commit 28225f3

Please sign in to comment.