apache / apache/lucene

Support optional pre-building QueryCache for newly generated segments

Open
#16,495 5 comments 0 reactions 0 assignees View on GitHub
type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

Some of our production clusters rely heavily on `QueryCache`. Queries perform well when cache hits occur. However, segment merge operations evict the corresponding `QueryCache` entries. From enhanced logs, we observed up to 2.3GB of cache being cleared under extreme conditions.

Image

New segments are created after merging, and `QueryCache` needs to be rebuilt for these new segments. The cache rebuilding process is resource-intensive. During this period, query latency rises drastically, and CPU on some nodes becomes fully saturated. This negatively impacts latency-sensitive services.

Image

Image

```
If we could introduce an pre-build cache for newly generated segments when there is remaining QueryCache` capacity. This can mitigate performance impacts on sensitive workloads.
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing QueryCache eviction during segment merge operations and the creation of newly generated segments. Determine where an optional pre-build could use remaining QueryCache capacity, and validate that the resulting cache is built for new segments without the described latency and CPU impact.

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
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.