Skip to content

Commit 89c396f

Browse files
authored
Increase the number of threads of GET threadpool (#92309)
Elasticsearch executes GET requests somewhat similar to SEARCH requests. Hence, they should have similar thread pools. Increasing the number of threads of the GET threadpool should help use-cases with many GET, MGETs requests.
1 parent dc7a8e6 commit 89c396f

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

docs/changelog/92309.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 92309
2+
summary: Increase the number of threads of GET threadpool
3+
area: Search
4+
type: enhancement
5+
issues: []

server/src/main/java/org/elasticsearch/action/search/TransportMultiSearchAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected void doExecute(Task task, MultiSearchRequest request, ActionListener<M
108108
static int defaultMaxConcurrentSearches(final int allocatedProcessors, final ClusterState state) {
109109
int numDateNodes = state.getNodes().getDataNodes().size();
110110
// we bound the default concurrency to preserve some search thread pool capacity for other searches
111-
final int defaultSearchThreadPoolSize = Math.min(ThreadPool.searchThreadPoolSize(allocatedProcessors), 10);
111+
final int defaultSearchThreadPoolSize = Math.min(ThreadPool.searchOrGetThreadPoolSize(allocatedProcessors), 10);
112112
return Math.max(1, numDateNodes * defaultSearchThreadPoolSize);
113113
}
114114

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,12 @@ public ThreadPool(final Settings settings, final ExecutorBuilder<?>... customBui
187187
new ScalingExecutorBuilder(Names.GENERIC, 4, genericThreadPoolMax, TimeValue.timeValueSeconds(30), false)
188188
);
189189
builders.put(Names.WRITE, new FixedExecutorBuilder(settings, Names.WRITE, allocatedProcessors, 10000, false));
190-
builders.put(Names.GET, new FixedExecutorBuilder(settings, Names.GET, allocatedProcessors, 1000, false));
190+
builders.put(Names.GET, new FixedExecutorBuilder(settings, Names.GET, searchOrGetThreadPoolSize(allocatedProcessors), 1000, false));
191191
builders.put(Names.ANALYZE, new FixedExecutorBuilder(settings, Names.ANALYZE, 1, 16, false));
192-
builders.put(Names.SEARCH, new FixedExecutorBuilder(settings, Names.SEARCH, searchThreadPoolSize(allocatedProcessors), 1000, true));
192+
builders.put(
193+
Names.SEARCH,
194+
new FixedExecutorBuilder(settings, Names.SEARCH, searchOrGetThreadPoolSize(allocatedProcessors), 1000, true)
195+
);
193196
builders.put(Names.SEARCH_COORDINATION, new FixedExecutorBuilder(settings, Names.SEARCH_COORDINATION, halfProcMaxAt5, 1000, true));
194197
builders.put(
195198
Names.AUTO_COMPLETE,
@@ -557,7 +560,7 @@ static int oneEighthAllocatedProcessors(final int allocatedProcessors) {
557560
return boundedBy(allocatedProcessors / 8, 1, Integer.MAX_VALUE);
558561
}
559562

560-
public static int searchThreadPoolSize(final int allocatedProcessors) {
563+
public static int searchOrGetThreadPoolSize(final int allocatedProcessors) {
561564
return ((allocatedProcessors * 3) / 2) + 1;
562565
}
563566

0 commit comments

Comments
 (0)