From 073048abf2e67161457c33a7403149db025bc14d Mon Sep 17 00:00:00 2001 From: John Verwolf Date: Mon, 8 Apr 2024 09:28:34 -0700 Subject: [PATCH] Track ongoing search tasks (#107129) --- docs/changelog/107129.yaml | 5 +++++ .../elasticsearch/threadpool/ThreadPool.java | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 docs/changelog/107129.yaml diff --git a/docs/changelog/107129.yaml b/docs/changelog/107129.yaml new file mode 100644 index 0000000000000..6c9b9094962c1 --- /dev/null +++ b/docs/changelog/107129.yaml @@ -0,0 +1,5 @@ +pr: 107129 +summary: Track ongoing search tasks +area: Search +type: enhancement +issues: [] diff --git a/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java b/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java index cf554fe81d4a3..507eff05780b8 100644 --- a/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java +++ b/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java @@ -151,6 +151,8 @@ public static ThreadPoolType fromType(String type) { entry(Names.SYSTEM_CRITICAL_WRITE, ThreadPoolType.FIXED) ); + public static final double searchAutoscalingEWMA = 0.1; + private final Map executors; private final ThreadPoolInfo threadPoolInfo; @@ -222,7 +224,13 @@ public ThreadPool(final Settings settings, MeterRegistry meterRegistry, final Ex builders.put(Names.ANALYZE, new FixedExecutorBuilder(settings, Names.ANALYZE, 1, 16, TaskTrackingConfig.DO_NOT_TRACK)); builders.put( Names.SEARCH, - new FixedExecutorBuilder(settings, Names.SEARCH, searchOrGetThreadPoolSize, 1000, TaskTrackingConfig.DEFAULT) + new FixedExecutorBuilder( + settings, + Names.SEARCH, + searchOrGetThreadPoolSize, + 1000, + new TaskTrackingConfig(true, searchAutoscalingEWMA) + ) ); builders.put( Names.SEARCH_WORKER, @@ -230,7 +238,13 @@ public ThreadPool(final Settings settings, MeterRegistry meterRegistry, final Ex ); builders.put( Names.SEARCH_COORDINATION, - new FixedExecutorBuilder(settings, Names.SEARCH_COORDINATION, halfProc, 1000, TaskTrackingConfig.DEFAULT) + new FixedExecutorBuilder( + settings, + Names.SEARCH_COORDINATION, + halfProc, + 1000, + new TaskTrackingConfig(true, searchAutoscalingEWMA) + ) ); builders.put( Names.AUTO_COMPLETE,