Expand description
SIEVE Page Cache Implementation
A simple, efficient page cache using the SIEVE eviction algorithm. SIEVE outperforms LRU in many workloads while being simpler to implement.
§SIEVE Algorithm (NSDI ’24)
SIEVE uses a single “visited” bit instead of LRU’s complex list management:
- On cache hit: set visited = true
- On cache miss (insertion): add to FIFO queue
- On eviction: sweep from “hand” position
- If visited=true: clear bit, skip
- If visited=false: evict this entry
§References
- Turso
core/storage/page_cache.rs:24-80- PageCacheShardEntry with ref_bit - Turso
core/storage/page_cache.rs:129-150- advance_clock_hand() - “SIEVE is Simpler than LRU” (NSDI ’24)
Structs§
- Cache
Stats - Cache statistics
- Page
Cache - Sharded page cache.
- Page
Cache Shard - SIEVE-based page cache
Constants§
- DEFAULT_
CACHE_ CAPACITY - Default cache capacity (number of pages) Turso uses 100,000 pages (~400MB for 4KB pages)
- MIN_
CACHE_ CAPACITY - Minimum cache capacity