This guide summarizes practical trade-offs and mirrors the benchmark-driven guidance in the latest benchmark guide.
Feature flags: Each policy is gated behind a feature flag (e.g. policy-lru, policy-s3-fifo). Enable only the policies you need for smaller builds. See Compatibility and Features.
- General purpose, skewed workloads:
LRUorS3-FIFO - Scan-heavy workloads:
S3-FIFOorHeap-LFU - Low latency required:
LRUorClock - Memory constrained:
LRUorClock - Frequency-aware:
LFU,Heap-LFU, orLRU-K - Shifting patterns:
S3-FIFOor2Q - Mixed one-hit + frequent:
2QorS3-FIFO
- LRU: Great default for temporal locality; fast; scan-vulnerable.
- Clock: LRU-like with lower overhead; similar latency to LRU.
- S3-FIFO: Strong scan resistance with low overhead; solid default for mixed workloads.
- LFU / Heap-LFU: Frequency-driven; stable hot sets; slower to adapt.
- LRU-K: Strong scan resistance; more metadata per entry.
- 2Q: Simple scan resistance; needs queue sizing.