When a memcached client receives SERVER_ERROR out of memory storing object, the daemon refused a SET because it could not allocate a chunk for the item. The store_no_memory counter increments. Under default operation, memcached evicts LRU items from the relevant slab class to make room. This error means eviction was either disabled or could not produce a free chunk for that allocation.
Two root causes. First, the instance was started with -M, which disables eviction entirely and returns errors instead of evicting. Second, slab-level exhaustion: a specific slab class has no free chunks and no pages can be reassigned to it. The second case is rarer on 1.5.0+ where slab_automove defaults to on, but still happens when all pages are busy or TEMP_LRU holds unevictable items.
The discriminator: is this refusing writes by design (-M), or a sizing or slab imbalance problem?
What this means
The error string SERVER_ERROR out of memory storing object is generated by the out_of_memory() helper in memcached’s text protocol handler (proto_text.c). It is returned when a SET, ADD, CAS, or REPLACE cannot allocate a chunk for the item. The store_no_memory counter in stats output tracks these failures.
The key discriminator is the relationship between two counters:
store_no_memoryclimbing whileevictionsstays at zero: the daemon is running with-M. Writes are refused by design.store_no_memoryclimbing alongside evictions in specific slab classes: a slab class exhausted its free chunks and could not steal a page. This is a sizing or imbalance problem.
flowchart TD
A["store_no_memory climbing"] --> B{"evict_to_free = 0?"}
B -->|"Yes: -M active"| C["Stores refused by design"]
C --> D{"bytes near limit?"}
D -->|"Yes"| E["Remove -M or increase -m"]
B -->|"No: eviction on"| F{"Per-slab outofmemory > 0?"}
F -->|"Yes"| G["Slab class exhausted"]
G --> H{"automove enabled?"}
H -->|"No"| I["Enable automove or reassign page"]
H -->|"Yes, cannot keep up"| J["Increase -m or adjust -f"]
F -->|"No"| K["Check TEMP_LRU pressure"]Common causes
| Cause | What it looks like | First thing to check |
|---|---|---|
-M (no-eviction mode) enabled | store_no_memory climbing, evictions at zero, bytes near limit_maxbytes | stats settings for evict_to_free |
Slab class exhaustion (no -M) | store_no_memory in specific size classes, some evictions present, one slab class at zero free_chunks with no pages to reassign | stats slabs and stats items for the saturated class |
| TEMP_LRU filling memory | store_no_memory on non-temporary items, large TEMP segments, high temporary_ttl | stats items per-class number_temp counts |
| All slab classes saturated | store_no_memory climbing globally, high evictions across multiple classes, bytes at limit_maxbytes | bytes / limit_maxbytes ratio and per-slab used_chunks |
Quick checks
These commands are read-only and safe to run during an incident.
# Check if -M (no-eviction) mode is active
# evict_to_free = 0 means -M is active; stores fail instead of evicting
echo "stats settings" | nc -q1 localhost 11211 | grep evict_to_free
# Check store_no_memory alongside evictions and memory usage
echo "stats" | nc -q1 localhost 11211 | grep -E "STAT (store_no_memory|evictions|bytes |limit_maxbytes)"
# Check per-slab memory distribution
echo "stats slabs" | nc -q1 localhost 11211 | grep -E "(used_chunks|free_chunks|total_pages)"
# Check per-slab eviction and OOM details
echo "stats items" | nc -q1 localhost 11211 | grep -E "(evicted|outofmemory|number_temp)"
# Check slab_automove status (1 = default since 1.5.0)
echo "stats settings" | nc -q1 localhost 11211 | grep slab_automove
# Check TEMP_LRU configuration
echo "stats settings" | nc -q1 localhost 11211 | grep temporary_ttl
How to diagnose it
Confirm whether
-Mis active. Runstats settingsand look atevict_to_free. A value of0means the daemon was started with-Mand is refusing writes by design. A value of1means eviction is enabled and you have a genuine allocation failure.If
-Mis active, confirm the cache is actually full. Checkbytesagainstlimit_maxbytes. If usage is near the limit, the daemon is behaving correctly for its configuration: it cannot evict, so it refuses writes. The fix is to remove-Mor increase-m. If usage is well below the limit with-Mon, look for slab-level exhaustion instead.If
-Mis not active, identify which slab class is failing. Runstats itemsand look for classes with non-zerooutofmemorycounts. Theoutofmemorycounter per slab class tracks how many times that class failed to allocate a chunk. This pinpoints the problem to a specific item size range.For each failing slab class, check page availability. Run
stats slabsand look at the class’stotal_pages,used_chunks, andfree_chunks. Iffree_chunksis zero andtotal_pagesis low relative to other classes, the class is starved. If other classes have many free chunks and zero recent evictions, this is slab calcification.Check whether
slab_automovecan help. Runstats settingsand look forslab_automove. Mode1(default since 1.5.0) slowly moves pages from idle classes to evicting ones. Mode0means it is off. If it is off, enable it. If it is on but cannot keep up, the cache may be genuinely undersized for the working set in that size class.Check for TEMP_LRU pressure. If
temporary_ttlis set, items with TTLs below that threshold go into a TEMP segment that bypasses normal eviction. Runstats itemsand look atnumber_tempper class. If TEMP segments are large relative to HOT, WARM, and COLD, they may be holding memory that cannot be reclaimed through eviction, starving non-temporary stores.
Metrics and signals to monitor
| Signal | Why it matters | Warning sign |
|---|---|---|
store_no_memory | Direct counter of refused stores | Any sustained non-zero rate |
evictions | Tells you whether eviction is happening at all | Zero evictions plus climbing store_no_memory means -M mode |
evict_to_free (from stats settings) | Whether -M is active | Value of 0 means no-eviction mode |
bytes / limit_maxbytes | Global memory utilization | Near 1.0 means cache is full |
Per-slab outofmemory (from stats items) | Which slab classes failed allocations | Any non-zero value |
Per-slab free_chunks and total_pages | Whether a class has room or can receive pages | free_chunks at zero with low total_pages |
slab_automove (from stats settings) | Whether automatic page rebalancing is active | Value of 0 means disabled |
temporary_ttl (from stats settings) | Whether TEMP_LRU is enabled and its threshold | Non-zero value means some items are unevictable until expiry |
direct_reclaims | Worker threads evicting directly instead of via LRU maintainer | Sustained non-zero indicates severe pressure |
Fixes
If -M is active: remove it or size the cache for it
The -M flag is a deliberate choice: the daemon returns errors instead of evicting. Some teams use it for caches where serving stale data is worse than a miss, and the application handles cache misses by falling through to the backend.
If the application cannot tolerate refused writes, remove -M from the startup flags and restart. This requires a restart; the flag cannot be toggled at runtime. Removing -M means the cache will evict under pressure. If the working set exceeds cache size, you will see evictions and potentially declining hit ratio instead of store_no_memory. The application must handle both cases the same way: miss on an evicted key, miss on a refused write, both fall through to the backend.
If you want to keep -M but stop the errors, increase -m. This also requires a restart. You can use cache_memlimit to raise the memory limit at runtime (since 1.4.31), which helps if the host has spare RAM, but it does not change the -M behavior.
Tradeoff: -M guarantees no eviction-induced stale data, at the cost of refusing writes when full. Without -M, writes always succeed, at the cost of evicting items that may still be useful.
If a slab class is exhausted (no -M)
This is slab calcification or a genuine size-class shortage. The fix depends on whether slab_automove can help.
If slab_automove is off (mode 0), enable it at runtime:
# Enable conservative automatic page rebalancing (safe, moves 1 page per 10s)
echo "slabs automove 1" | nc -q1 localhost 11211
For immediate relief, manually reassign a page from an idle class:
# Destructive: items in the moved page are evicted.
# Only move from classes with zero recent evictions and significant free chunks.
echo "slabs reassign <source_class> <destination_class>" | nc -q1 localhost 11211
If slab_automove is already on (mode 1) and cannot keep up, you can temporarily switch to mode 2 (aggressive), though this can cause latency jitter.
If all classes are saturated rather than just one, the cache is genuinely undersized. Increase -m or add instances. Adjusting the growth factor (-f, default 1.25) on the next restart can reduce internal fragmentation and improve slab class fit for your workload’s item size distribution. A lower factor creates more granular classes with less wasted space per chunk, at the cost of more classes competing for pages.
If TEMP_LRU is filling memory
TEMP_LRU (since 1.4.35) routes items with TTLs below temporary_ttl into a TEMP segment that bypasses normal eviction. The LRU maintainer background thread reaps them on expiry. If temporary_ttl is set too high, many items become effectively unevictable for their lifetime and can fill memory, causing store_no_memory on non-temporary items.
Check stats items for number_temp counts per class. If TEMP segments are large relative to HOT, WARM, and COLD, lower temporary_ttl or review whether short-TTL items should bypass eviction at all.
temporary_ttl is set at startup via -o temporary_ttl=<N>. Changing it requires a restart.
Prevention
Audit startup flags. Know whether your instances run with
-M. A cache running with-Mthat is expected to evict will producestore_no_memoryunder load, and the team may not realize the configuration is the cause. Document the intent behind-Mwherever it is used.Alert on
store_no_memoryrate. Pair it withevictions. Ifevictionsis zero andstore_no_memoryis climbing, the instance is in-Mmode and full. This signature is the fastest way to distinguish “by design” from “genuinely broken.”Monitor per-slab
outofmemoryfromstats items. This catches slab-level exhaustion before it becomes a client-visible error storm. Pollstats itemsno more frequently than every 30 seconds; it is heavier thanstats.Verify
slab_automoveis enabled (mode1) on 1.5.0+. This is the default but can be overridden by startup flags or orchestrator configs. Confirm withstats settings.Set
temporary_ttlconservatively. Items in the TEMP segment are not evictable. A high threshold can crowd out normal items and cause allocation failures that look like undersizing but are actually a TEMP_LRU configuration issue.Size the cache with headroom. With
slab_automoveactive, target 15-20% global headroom. The cliff edge is per slab class: once a class is full, stores to that class fail immediately.
How Netdata helps
The memcached collector surfaces
store_no_memoryandevictionsas per-second charts. The zero-evictions-plus-climbing-store_no_memory signature is visible without manualnccommands.Per-slab charts from
stats itemsandstats slabsshow which slab class is exhausted and whetherfree_chunksis at zero.Settings like
evict_to_freeandslab_automoveare collected fromstats settings, letting you confirm whether-Mis active and whether rebalancing is enabled across the fleet.Correlating
store_no_memorywithbytes / limit_maxbytes, per-slabused_chunks, anddirect_reclaimsin a single view distinguishes design (-M) from sizing from slab imbalance.
Related guides
- Memcached evicted_unfetched and expired_unfetched: caching data nobody ever reads
- Memcached cas_badval climbing: check-and-set contention and lost updates
- Memcached connection refused: telling a dead process from a hung or full one
- Memcached evicted_time low: distinguishing healthy turnover from cache thrash
- Memcached eviction cascade: when a full cache overloads the backend
- Memcached evictions climbing: the cache is full and discarding live data
- Memcached high miss rate: separating cold start, new key patterns, and memory pressure
- How Memcached actually works in production: a mental model for operators
- Memcached incr/decr misses: evicted counters that silently break rate limiters and locks
- Memcached hit ratio dropping: reading get_hits, get_misses, and cache effectiveness
- Memcached monitoring checklist: the signals every production cache needs
- Memcached monitoring maturity model: from survival to expert






