Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pxsalehi committed Aug 28, 2024
1 parent f472007 commit 79bada9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.Map;

import static java.util.Collections.unmodifiableMap;
import static org.elasticsearch.threadpool.ThreadPool.indexAutoscalingEWMA;
import static org.elasticsearch.threadpool.ThreadPool.searchAutoscalingEWMA;

public class DefaultBuiltInExecutorBuilders implements BuiltInExecutorBuilders {
Expand All @@ -41,7 +42,7 @@ public Map<String, ExecutorBuilder> getBuilders(Settings settings, int allocated
ThreadPool.Names.WRITE,
allocatedProcessors,
10000,
new EsExecutors.TaskTrackingConfig(true, 0.1)
new EsExecutors.TaskTrackingConfig(true, indexAutoscalingEWMA)
)
);
int searchOrGetThreadPoolSize = ThreadPool.searchOrGetThreadPoolSize(allocatedProcessors);
Expand Down Expand Up @@ -187,7 +188,7 @@ public Map<String, ExecutorBuilder> getBuilders(Settings settings, int allocated
ThreadPool.Names.SYSTEM_WRITE,
halfProcMaxAt5,
1000,
new EsExecutors.TaskTrackingConfig(true, 0.1)
new EsExecutors.TaskTrackingConfig(true, indexAutoscalingEWMA)
)
);
result.put(
Expand All @@ -207,7 +208,7 @@ public Map<String, ExecutorBuilder> getBuilders(Settings settings, int allocated
ThreadPool.Names.SYSTEM_CRITICAL_WRITE,
halfProcMaxAt5,
1500,
new EsExecutors.TaskTrackingConfig(true, 0.1)
new EsExecutors.TaskTrackingConfig(true, indexAutoscalingEWMA)
)
);
return unmodifiableMap(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ public static ThreadPoolType fromType(String type) {

public static final double searchAutoscalingEWMA = 0.1;

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

private final Map<String, ExecutorHolder> executors;

private final ThreadPoolInfo threadPoolInfo;
Expand Down

0 comments on commit 79bada9

Please sign in to comment.