SERVER_ERROR out of memory in memcached slab allocator
0 reputation · 11 Dec 2020, 21:14 UTC
SERVER_ERROR out of memory in slab allocator
Memcached's slab allocator divides memory into fixed-size chunks grouped into slab classes. Once a page is assigned to a specific slab class it cannot be reassigned to another class during the daemon's lifecycle.
A shift in stored item sizes can exhaust one slab class while other classes retain free memory. In that state the server returns SERVER_ERROR out of memory to clients even though total available memory is sufficient for the request. Pre-allocation with -L and growth factor -f only define startup behavior and cannot adapt to runtime workload changes. No native mechanism exists to move pages between classes or trigger global defragmentation without a restart.
Runtime constraints
The unresolved design decision is whether page rebalancing can be implemented to allow dynamic slab class resizing without downtime, a topic discussed but not adopted due to complexity and lock contention concerns.
- Is a documented method available to force reallocation of pages from an underutilized slab class to one reporting SERVER_ERROR out of memory?
- Which runtime signals indicate slab class imbalance before client errors occur?
- Can the daemon maintain cache contents while correcting slab class exhaustion?