OOM data resource_error ai_generated true

Redis OOM command not allowed when used memory > 'maxmemory'

ID: data/redis-oom-command-not-allowed

Also available as: JSON · Markdown · 中文
87%Fix Rate
89%Confidence
1Evidence
2023-08-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Redis 6.2 active
Redis 7.0 active
Redis 7.2 active

Root Cause

Redis reaches its configured maxmemory limit and the eviction policy is set to noeviction, causing write commands to fail with OOM error.

generic

中文

Redis达到配置的maxmemory限制,且逐出策略设置为noeviction,导致写入命令因内存不足而失败。

Official Documentation

https://redis.io/docs/latest/operate/oss_and_stack/management/admin/#maxmemory

Workarounds

  1. 93% success Change the eviction policy to allkeys-lru to automatically evict least recently used keys when memory is full.
    Change the eviction policy to allkeys-lru to automatically evict least recently used keys when memory is full.
  2. 85% success Add more RAM to the server and increase maxmemory to a safe limit below total RAM.
    Add more RAM to the server and increase maxmemory to a safe limit below total RAM.

中文步骤

  1. Change the eviction policy to allkeys-lru to automatically evict least recently used keys when memory is full.
  2. Add more RAM to the server and increase maxmemory to a safe limit below total RAM.

Dead Ends

Common approaches that don't work:

  1. 85% fail

    Without setting an eviction policy, Redis will fill up again quickly.

  2. 75% fail

    If the system has no free RAM, Redis will swap to disk, severely degrading performance.