Skip to content

Commit f988e92

Browse files
authored
Use EWMATrackingEsThreadPoolExecutor for WRITE (#96921)
Relates ES-6248
1 parent 8fc0eec commit f988e92

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public ThreadPool(final Settings settings, final ExecutorBuilder<?>... customBui
188188
Names.GENERIC,
189189
new ScalingExecutorBuilder(Names.GENERIC, 4, genericThreadPoolMax, TimeValue.timeValueSeconds(30), false)
190190
);
191-
builders.put(Names.WRITE, new FixedExecutorBuilder(settings, Names.WRITE, allocatedProcessors, 10000, false));
191+
builders.put(Names.WRITE, new FixedExecutorBuilder(settings, Names.WRITE, allocatedProcessors, 10000, true));
192192
builders.put(Names.GET, new FixedExecutorBuilder(settings, Names.GET, searchOrGetThreadPoolSize(allocatedProcessors), 1000, false));
193193
builders.put(Names.ANALYZE, new FixedExecutorBuilder(settings, Names.ANALYZE, 1, 16, false));
194194
builders.put(

server/src/test/java/org/elasticsearch/threadpool/ThreadPoolTests.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.elasticsearch.common.logging.Loggers;
1515
import org.elasticsearch.common.settings.Settings;
1616
import org.elasticsearch.common.unit.ByteSizeValue;
17+
import org.elasticsearch.common.util.concurrent.EWMATrackingEsThreadPoolExecutor;
1718
import org.elasticsearch.common.util.concurrent.EsExecutors;
1819
import org.elasticsearch.common.util.concurrent.FutureUtils;
1920
import org.elasticsearch.core.TimeValue;
@@ -30,6 +31,7 @@
3031
import static org.elasticsearch.threadpool.ThreadPool.halfAllocatedProcessorsMaxFive;
3132
import static org.hamcrest.CoreMatchers.equalTo;
3233
import static org.hamcrest.Matchers.greaterThan;
34+
import static org.hamcrest.Matchers.instanceOf;
3335

3436
public class ThreadPoolTests extends ESTestCase {
3537

@@ -348,4 +350,13 @@ public void testGetMaxSnapshotCores() {
348350
allocatedProcessors = randomIntBetween(1, 16);
349351
assertThat(getMaxSnapshotThreadPoolSize(allocatedProcessors, ByteSizeValue.ofGb(4)), equalTo(10));
350352
}
353+
354+
public void testWriteThreadPoolUsesEWMATrackingEsThreadPoolExecutor() {
355+
final ThreadPool threadPool = new TestThreadPool("test", Settings.EMPTY);
356+
try {
357+
assertThat(threadPool.executor(ThreadPool.Names.WRITE), instanceOf(EWMATrackingEsThreadPoolExecutor.class));
358+
} finally {
359+
assertTrue(terminate(threadPool));
360+
}
361+
}
351362
}

0 commit comments

Comments
 (0)