From 72901d41400e1fa5f1dd3af82f7fa765a4bec122 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 18 Jul 2023 20:38:31 +0200 Subject: [PATCH] Change downsample threadpool size. (#97714) Changed the downsample threadpool size to one eight of the allocated processors. Downsampling is a cpu intensive operation (search + heavy aggregation that rolls up documents) and could overwhelm a node. On top of this the downsample operation also delegates to force merge api, which has a threadpool that is also bounded to one eight of the allocated processors. Relates to #97141 --- .../src/main/java/org/elasticsearch/threadpool/ThreadPool.java | 2 +- .../src/main/java/org/elasticsearch/xpack/rollup/Rollup.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java b/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java index e0fc75db3306f..f0d2aa6ca0183 100644 --- a/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java +++ b/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java @@ -601,7 +601,7 @@ static int twiceAllocatedProcessors(final int allocatedProcessors) { return boundedBy(2 * allocatedProcessors, 2, Integer.MAX_VALUE); } - static int oneEighthAllocatedProcessors(final int allocatedProcessors) { + public static int oneEighthAllocatedProcessors(final int allocatedProcessors) { return boundedBy(allocatedProcessors / 8, 1, Integer.MAX_VALUE); } diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java index b642b7a9d51f2..7e6f807e5c4d3 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/Rollup.java @@ -146,7 +146,7 @@ public List> getExecutorBuilders(Settings settingsToUse) { final FixedExecutorBuilder downsample = new FixedExecutorBuilder( settingsToUse, Rollup.DOWSAMPLE_TASK_THREAD_POOL_NAME, - ThreadPool.searchOrGetThreadPoolSize(EsExecutors.allocatedProcessors(settingsToUse)), + ThreadPool.oneEighthAllocatedProcessors(EsExecutors.allocatedProcessors(settingsToUse)), Rollup.DOWNSAMPLE_TASK_THREAD_POOL_QUEUE_SIZE, "xpack.downsample.thread_pool", EsExecutors.TaskTrackingConfig.DO_NOT_TRACK