explore: foyer hybrid cache for search (memory + disk)#6319
Draft
fmassot wants to merge 3 commits into
Draft
Conversation
d6cfcd1 to
0514712
Compare
Adds an optional NVMe disk tier (via foyer) to Quickwit's search caches.
Entries evicted from the in-memory tier spill to local disk instead of
being lost; the next access reads from disk (~0.1ms) instead of going
back to S3 (~50-200ms).
Caches with a hybrid disk tier:
- `partial_request_cache` -> LeafSearchCache::{MemoryOnly, Hybrid}.
- `fast_field_cache` (.fast route in QuickwitCache) -> backed by a new
FoyerStorageCache implementing the StorageCache trait.
- `split_footer_cache` -> SplitFooterCache::{Memory, Hybrid}.
The `predicate_cache` stays memory-only: its access trait
`quickwit_query::query_ast::PredicateCache` is synchronous (called
inside tantivy scoring hot paths), so a disk tier would require an
async trait migration which is out of scope for this PR.
Config (new fields on `SearcherConfig`, all default 0 = disabled):
- `fast_field_disk_cache_capacity: ByteSize`
- `split_footer_disk_cache_capacity: ByteSize`
- `partial_request_disk_cache_capacity: ByteSize`
A non-zero value on any of these enables the corresponding hybrid
cache. Disk files land under `{data_dir}/search-cache/{fast-field,
split-footer,partial-request}/`. Use a local NVMe mount (EBS contention
will mask the benefit).
Other changes:
- `quickwit-storage::metrics` is now public so `SingleCacheMetrics` is
accessible from `quickwit-search`.
- `LeafSearchCache::Hybrid` and `SplitFooterCache::Hybrid` report hits
and misses to the existing Prometheus counters.
Notes:
- The previous single `partial_request_disk_cache_{enabled,capacity}`
field was misleading: it actually controlled disk capacity for both
the partial_request cache and the fast_field route. Replaced by the
three per-cache knobs above.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0514712 to
66b8bbf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exploration of using foyer as a hybrid (memory + NVMe disk) cache for search caches. When entries are evicted from memory, they spill to local disk instead of being lost.
This is an exploration branch — not production-ready.