apache / apache/lucene

Do not cache clauses if they might make the query more than X times slower [LUCENE-8027]

Open
#9,075 5 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Minor type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Query caching can have a negative impact on tail latencies as the clause that is cached needs to be entirely consumed. Maybe we could leverage the fact that we can know the lead cost from any scorer now (#8947) in order to implement heuristics that would look like "do not cache clause X if its cost is 10x greater than the cost of the entire query". This would make sure that a fast query can not become absurdly slow just because it had to cache a costly filter. The filter will need to wait for a more costly query to be cached, or might never be cached at all.

---
Migrated from [LUCENE-8027](https://issues.apache.org/jira/browse/LUCENE-8027) by Adrien Grand (@jpountz), updated Oct 17 2019
Attachments: [LUCENE-8027.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-8027/LUCENE-8027.patch)
Linked issues:
- #10045

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the query-caching context in this issue, the migrated LUCENE-8027.patch attachment, and linked issue #10045. Investigate how scorer lead cost and full-query cost are exposed. Done means an agreed heuristic prevents caching clauses that could make a query substantially slower, with behavior covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.