Skip to content

Commit

Permalink
Internal: reduce the size of the search thread pool.
Browse files Browse the repository at this point in the history
Follow-up of #9135. We initially decreased the stack size because it would end
up a lot of memory when there are many threads. But we also have some thread
pools that may be oversized, in particular the search thread pool.

This commit proposes to decrease the default search thread pool size from
`3 * num_procs` to `3 * num_procs / 2 + 1`. This is large enough to be sure
that we can use all the machine resources even with a search-only work load
but not too large in order to not consume too much memory because of the stack
size and thread locals.
  • Loading branch information
jpountz committed Apr 2, 2015
1 parent e8a42c6 commit 08388e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -59,8 +59,8 @@ private static int maximumSearchThreadPoolSize(ThreadPool threadPool, Settings s
assert searchThreadPool != null;
final int maxSize = searchThreadPool.getMax();
if (maxSize <= 0) {
// happens with cached thread pools, let's assume there are at most 3x ${number of processors} threads
return 3 * EsExecutors.boundedNumberOfProcessors(settings);
// happens with cached thread pools, let's assume there are at most 2x ${number of processors} threads
return 2 * EsExecutors.boundedNumberOfProcessors(settings);
} else {
return maxSize;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/elasticsearch/threadpool/ThreadPool.java
Expand Up @@ -113,7 +113,7 @@ public ThreadPool(Settings settings, @Nullable NodeSettingsService nodeSettingsS
.put(Names.INDEX, settingsBuilder().put("type", "fixed").put("size", availableProcessors).put("queue_size", 200).build())
.put(Names.BULK, settingsBuilder().put("type", "fixed").put("size", availableProcessors).put("queue_size", 50).build())
.put(Names.GET, settingsBuilder().put("type", "fixed").put("size", availableProcessors).put("queue_size", 1000).build())
.put(Names.SEARCH, settingsBuilder().put("type", "fixed").put("size", availableProcessors * 3).put("queue_size", 1000).build())
.put(Names.SEARCH, settingsBuilder().put("type", "fixed").put("size", ((availableProcessors * 3) / 2) + 1).put("queue_size", 1000).build())
.put(Names.SUGGEST, settingsBuilder().put("type", "fixed").put("size", availableProcessors).put("queue_size", 1000).build())
.put(Names.PERCOLATE, settingsBuilder().put("type", "fixed").put("size", availableProcessors).put("queue_size", 1000).build())
.put(Names.MANAGEMENT, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", 5).build())
Expand Down

0 comments on commit 08388e0

Please sign in to comment.