Cache with memory leak

- A troubleshooting thread described a cache hitting 95% hit rate while memory usage kept growing until crash. - The striking detail: extremely high hit rates did not prevent an out‑of‑memory failure. - The thread offers debugging tips and highlights how high cache hit rates can mask severe lifecycle or eviction bugs. (x.com)

A cache can answer 95% of requests from memory and still crash from memory growth if old entries, references, or buffers never get released. (threadreaderapp.com) (redis.io) That was the setup in an April 2026 troubleshooting thread by Abhishek Singh, who described a cache with a roughly 95% hit rate while process memory kept climbing until an out-of-memory failure. The thread was posted on X by the account @0xlelouch_. (piclur.com) (threadreaderapp.com) A cache hit rate measures how often data is found in the cache instead of fetched from the slower source behind it. Redis documents hits, misses, memory limits and eviction policy as separate controls, which means a strong hit rate does not guarantee bounded memory use. (redis.io 1) (redis.io 2) Redis says `maxmemory` sets the memory ceiling and eviction policy decides what gets removed when that ceiling is reached. Redis also notes some commands can temporarily push memory above the limit by a large amount before the system catches up. (redis.io) Memcached makes the same split between cache usefulness and cache size. Its docs tell operators to verify the memory cap with `limit_maxbytes`, because a cache can be serving requests well while still being started with the wrong memory settings. (docs.memcached.org 1) (docs.memcached.org 2) The failure pattern usually points to lifecycle bugs, not lookup quality: keys without time-to-live settings, eviction disabled or mis-set, code that keeps extra references to objects after the cache entry should be gone, or background buffers that never shrink. Redis exposes expired and evicted key events, which lets engineers check whether entries are actually leaving memory. (redis.io 1) (redis.io 2) The debugging playbook in platform docs starts with proving that memory really rises over time, then taking a heap dump or snapshot to see what objects stay alive. Microsoft’s.NET guide says to confirm sustained growth with counters before collecting a dump, and Node.js says heap snapshots can reveal retainers that keep memory from being freed. (learn.microsoft.com) (nodejs.org) Those tools can bite back in production. Node.js warns that building a heap snapshot happens in memory and can double heap use, which can itself crash the process if the service is already close to its limit. (nodejs.org) The practical check is simple: graph hit rate next to resident memory, heap size, object counts, evictions, expirations and item age. A flat 95% hit rate with rising memory and low evictions is not a healthy cache; it is a cache that may not be forgetting. (redis.io) (redis.io)

Get your own daily briefing

Scout delivers personalized news, insights, and conversations tailored to your role and industry.

Download on the App Store

Shared from Scout - Be the smartest in the room.