Skip to content

Commit a8dcd0f

Browse files
pxsalehicbuescher
authored andcommitted
Reduce write thread pool EWMA alpha (elastic#112206)
This helps reduce the impact of single long running tasks on the EWMA, which is used for interpreting the queue contribution to ingestion load in ingest autoscaling.
1 parent 840ce89 commit a8dcd0f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

server/src/main/java/org/elasticsearch/threadpool/DefaultBuiltInExecutorBuilders.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Map;
1919

2020
import static java.util.Collections.unmodifiableMap;
21+
import static org.elasticsearch.threadpool.ThreadPool.indexAutoscalingEWMA;
2122
import static org.elasticsearch.threadpool.ThreadPool.searchAutoscalingEWMA;
2223

2324
public class DefaultBuiltInExecutorBuilders implements BuiltInExecutorBuilders {
@@ -41,7 +42,7 @@ public Map<String, ExecutorBuilder> getBuilders(Settings settings, int allocated
4142
ThreadPool.Names.WRITE,
4243
allocatedProcessors,
4344
10000,
44-
new EsExecutors.TaskTrackingConfig(true, 0.1)
45+
new EsExecutors.TaskTrackingConfig(true, indexAutoscalingEWMA)
4546
)
4647
);
4748
int searchOrGetThreadPoolSize = ThreadPool.searchOrGetThreadPoolSize(allocatedProcessors);
@@ -187,7 +188,7 @@ public Map<String, ExecutorBuilder> getBuilders(Settings settings, int allocated
187188
ThreadPool.Names.SYSTEM_WRITE,
188189
halfProcMaxAt5,
189190
1000,
190-
new EsExecutors.TaskTrackingConfig(true, 0.1)
191+
new EsExecutors.TaskTrackingConfig(true, indexAutoscalingEWMA)
191192
)
192193
);
193194
result.put(
@@ -207,7 +208,7 @@ public Map<String, ExecutorBuilder> getBuilders(Settings settings, int allocated
207208
ThreadPool.Names.SYSTEM_CRITICAL_WRITE,
208209
halfProcMaxAt5,
209210
1500,
210-
new EsExecutors.TaskTrackingConfig(true, 0.1)
211+
new EsExecutors.TaskTrackingConfig(true, indexAutoscalingEWMA)
211212
)
212213
);
213214
return unmodifiableMap(result);

server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ public static ThreadPoolType fromType(String type) {
178178

179179
public static final double searchAutoscalingEWMA = 0.1;
180180

181+
// This value is chosen such that a sudden increase in the task durations would need to persist roughly for 120 samples
182+
// for the EWMA value to be mostly representative of the increased task durations. Mostly representative means that the
183+
// EWMA value is at least within 90% of the new increased task duration. This value also determines the impact of a single
184+
// long-running task on the moving average and limits it roughly to 2% of the (long) task duration, e.g. if the current
185+
// moving average is 100ms, and we get one task which takes 20s the new EWMA will be ~500ms.
186+
public static final double indexAutoscalingEWMA = 0.02;
187+
181188
private final Map<String, ExecutorHolder> executors;
182189

183190
private final ThreadPoolInfo threadPoolInfo;

0 commit comments

Comments
 (0)