feldera-buffer-cache
feldera-buffer-cache provides SieveCache, a sharded, weighted, thread-safe
in-memory buffer cache used by Feldera's storage layer.
The implementation is inspired by the NSDI'24 SIEVE paper: https://www.usenix.org/conference/nsdi24/presentation/zhang-yazhuo
Implementation
- Weighted capacity accounting. Every insert supplies a
charge, and eviction is based on the sum of charges instead of entry count. - Sharded concurrency.
SieveCache::new(total_capacity)usesSieveCache::DEFAULT_SHARDS, whileSieveCache::with_shards(...)lets the caller pick an explicit power-of-two shard count. - Cheap hit handling. A cache hit only flips a visited bit; it does not move the entry through a recency list.
- Shared values. Public operations return
Arc<V>so callers can keep values alive after removal or eviction.
API sketch
use SieveCache;
let cache = with_shards;
cache.insert;
let page = cache.get.expect;
assert_eq!;
Benchmarks
Comparisons against dbsp's old LRU buffer cache live under dbsp bench
targets so they exercise the real in-tree implementation: