You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ju...@apache.org on 2021/08/11 10:29:17 UTC

[lucene] branch main updated: LUCENE-10043: Decrease default LRUQueryCache#skipCacheFactor to 10 (#232)

This is an automated email from the ASF dual-hosted git repository.

julietibs pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new a9fb5a9  LUCENE-10043: Decrease default LRUQueryCache#skipCacheFactor to 10 (#232)
a9fb5a9 is described below

commit a9fb5a965dffd2600f7da7700e6429ebf19e14d6
Author: Julie Tibshirani <ju...@gmail.com>
AuthorDate: Wed Aug 11 13:29:12 2021 +0300

    LUCENE-10043: Decrease default LRUQueryCache#skipCacheFactor to 10 (#232)
    
    In LUCENE-9002 we introduced logic to skip caching a clause if it would be too
    expensive compared to the usual query cost. Specifically, we avoid caching a
    clause if its cost is estimated to be a 250x higher than the lead iterator's.
    We've found that the default of 250 is quite high and can lead to poor tail
    latencies. This PR decreases it to 10 to cache more conservatively.
---
 lucene/CHANGES.txt                                               | 4 ++++
 lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index fbad291..e491e8e 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -405,6 +405,10 @@ Improvements
 * LUCENE-9945: Extend DrillSideways to support exposing FacetCollectors directly.
   (Greg Miller, Sejal Pawar)
 
+* LUCENE-10043: Decrease default for LRUQueryCache's skipCacheFactor to 10.
+  This prevents caching a query clause when it is much more expensive than
+  running the top-level query. (Julie Tibshirani)
+
 Optimizations
 ---------------------
 * LUCENE-9996: Improved memory efficiency of IndexWriter's RAM buffer, in
diff --git a/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java b/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
index 1592836..dbce4ee 100644
--- a/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
+++ b/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
@@ -146,7 +146,7 @@ public class LRUQueryCache implements QueryCache, Accountable {
    * of the top-level query will be cached in order to not hurt latency too much because of caching.
    */
   public LRUQueryCache(int maxSize, long maxRamBytesUsed) {
-    this(maxSize, maxRamBytesUsed, new MinSegmentSizePredicate(10000, .03f), 250);
+    this(maxSize, maxRamBytesUsed, new MinSegmentSizePredicate(10000, .03f), 10);
   }
 
   // pkg-private for testing