From 3056570e453f27c6647dbbf8dfc13fff114063fd Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 16 May 2018 15:52:02 +0200 Subject: [PATCH] Increase the maximum number of filters that may be in the cache. We added this limit because we occasionally saw cases where most of the memory usage of the cache was spent on the keys (ie. queries) rather than the values, which caused the cache to vastly underestimate its memory usage. In recent releases, we disabled caching on heavy `terms` queries, which were the main source of the problem, so putting more entries in the cache should be safer. --- .../java/org/elasticsearch/indices/IndicesQueryCache.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/indices/IndicesQueryCache.java b/server/src/main/java/org/elasticsearch/indices/IndicesQueryCache.java index 60741c87f2165..2695c1728491b 100644 --- a/server/src/main/java/org/elasticsearch/indices/IndicesQueryCache.java +++ b/server/src/main/java/org/elasticsearch/indices/IndicesQueryCache.java @@ -52,8 +52,10 @@ public class IndicesQueryCache extends AbstractComponent implements QueryCache, public static final Setting INDICES_CACHE_QUERY_SIZE_SETTING = Setting.memorySizeSetting("indices.queries.cache.size", "10%", Property.NodeScope); + // mostly a way to prevent queries from being the main source of memory usage + // of the cache public static final Setting INDICES_CACHE_QUERY_COUNT_SETTING = - Setting.intSetting("indices.queries.cache.count", 1000, 1, Property.NodeScope); + Setting.intSetting("indices.queries.cache.count", 10_000, 1, Property.NodeScope); // enables caching on all segments instead of only the larger ones, for testing only public static final Setting INDICES_QUERIES_CACHE_ALL_SEGMENTS_SETTING = Setting.boolSetting("indices.queries.cache.all_segments", false, Property.NodeScope);