From ff03c34a6275ecd48a849cfc195fb23f0bbe9965 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 18 Jul 2023 21:33:41 +0200 Subject: [PATCH] Change downsample threadpool size. (#97714) (#97764) 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 961a79a2c59a3..72ba8284d2420 100644 --- a/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java +++ b/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java @@ -559,7 +559,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 75843a51de7d5..20136b3e30e3f 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 @@ -177,7 +177,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", false