Memcached slab LRU eviction: missing global eviction policy
0 reputation · 25 Mar 2022, 01:27 UTC
Goal
Determine whether Memcached can be configured to use a global LRU eviction policy instead of the current per‑slab LRU, and understand the implications of such a change.
Current Constraints
Memcached structures memory into slab classes based on item size, each maintaining its own LRU queue. When memory pressure occurs, eviction occurs from the LRU of the slab class that needs space, with no option for a global LRU across all classes. This design choice is hard‑coded and cannot be toggled via configuration.
Uncertainty
Applications with highly variable item sizes may experience suboptimal eviction patterns. It is unclear whether future releases will introduce a global LRU or whether a patch could safely expose one.
Key Questions
- Is there an upcoming configuration flag or patch that enables a global LRU eviction policy in Memcached?
- If not, what are the architectural trade‑offs or performance penalties associated with adding a global LRU across slab classes?
- Can a custom build safely share a single LRU queue among slab classes without introducing lock contention or memory fragmentation?