{
  "id": 17979643,
  "title": "Redis Memory Full and Keys Evicted: A Java Backend Checklist of 4 Spots",
  "url": "https://urgent.news/2026/11/03/redis-memory-full-and-keys-evicted-a-java-backend-checklist-of-4-spots",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-03T15:18:17.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/nicholas1991/redis-memory-full-and-keys-evicted-a-java-backend-checklist-of-4-spots-2o5i"
  },
  "original_language": "en",
  "account": "Redis memory usage reached its maximum capacity, causing key evictions. This resulted in the loss of login sessions, leading to users being logged out. The article provides a checklist of four spots to inspect when encountering this issue.\n\nFirstly, examine the maxmemory policy configuration. Redis employs a maxmemory-policy to determine which keys to evict when memory is full. The allkeys-lru policy, which deletes the least recently accessed keys from all cached data, was likely the default setting. However, this policy indiscriminately removes config data, product caches, rate-limit counters, and other essential keys, causing unexpected issues.\n\nSecondly, consider the eviction policy's scope. The allkeys-* policies evict all cached data, while the volatile-* policies only target keys with expiration times (TTL). Configuring the volatile-* policy ensures that only data with an expiration time is evicted, preserving critical configurations and other data.\n\nThirdly, monitor the Redis memory statistics to understand the root cause of the issue. Use the redis-cli tool to run the 'info memory' command, which provides details about memory usage, including used_memory, used_memory_rss, and mem_fragmentation_ratio. The evicted_keys metric will show the cumulative count of keys evicted since the process started. Increasing numbers indicate sustained memory pressure, suggesting a deeper problem.\n\nLastly, delve into the internal workings of Redis memory management. Redis uses a single-threaded command execution model, checking memory usage before executing every command. If memory exceeds the limit, Redis enters an eviction loop, deleting keys until memory falls below the threshold. The eviction process uses a timestamp-based Least Recently Used (LRU) algorithm, sampling a default of 5 keys to determine the least recently accessed ones. However, this sampling method may not accurately reflect the most frequently accessed keys.",
  "summary": "Wednesday afternoon, cache hit rate dropped from 98% to 62%, and database QPS quintupled. Ops checked around and said: Redis memory is maxed out, some keys were evicted, it's normal behavior. But the keys that got evicted happened to be login sessions, and users were collectively kicked offline. Memory full means eviction—sounds perfectly reasonable. The problem is which keys get evicted and why…",
  "key_points": [
    "Redis memory reached maximum capacity, causing key evictions and user logouts",
    "Allkeys-LRU eviction policy indiscriminately removed critical config data and caches",
    "Monitor Redis memory statistics (info memory command) to identify root cause"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}