redis no eviction mode, when will command be rejec...

Criado em: 16 de maio de 2026

Respondido usando GPT-5.5 Thinking por Chat01

Pergunta

redis no eviction mode, when will command be reject with oom error? will it accept one command that goes out of memory and reject anything else?

Pensamento

undefined

Pensamento

undefined

Pensamento

undefined

Pensamento

Clarifying Redis OOM behavior

Redis can temporarily exceed maxmemory limits with some commands. Generally, memory is checked when new data is added, but not always before command execution. The OOM error is on Redis level, not the OS. Commands may be rejected with "denyoom" if usage is too high — maxmemory-policy noeviction explains this.

Thought for 43s

Resposta

Yes — with maxmemory-policy noeviction, Redis will start returning OOM errors once used_memory is above the configured maxmemory, but it does not perfectly prevent a single accepted command from pushing memory over the limit.

Redis checks memory when a client runs a command that adds data; if memory is over the limit, it applies the configured policy. With noeviction, Redis does not evict keys and instead returns an error for commands that would cache/add new data; read-only commands still work normally. (Redis)

So the practical behavior is:

  1. If Redis is currently below maxmemory:
    A write command may be accepted. If that command allocates a lot of memory, it can push Redis over maxmemory. Redis docs explicitly note that a large command can temporarily exceed the limit by a large amount. (Redis)

  2. After Redis is over maxmemory:
    New commands marked denyoom are rejected with an OOM error. Redis command metadata defines denyoom as: command is rejected when server memory usage is too high. Examples include memory-growing writes like SET, MSET, LPUSH, ZADD, XADD, etc. (Redis)

  3. Not everything is rejected:
    Reads like GET, MGET, LRANGE, and admin/introspection commands generally continue. Memory-reducing commands such as DEL, UNLINK, LTRIM, or overwrites that reduce memory may still be allowed depending on command flags and behavior.

So your mental model is basically correct:

text
used_memory < maxmemory -> Redis may accept a write -> that write may push memory above maxmemory used_memory > maxmemory + noeviction -> Redis rejects further memory-growing writes with OOM -> reads and some cleanup commands still work

The error is usually:

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

The recovery is to delete/expire data, increase maxmemory, or change the eviction policy if Redis is acting as a cache rather than a durable data store.

Compartilhar esta Q&A