Quick revision
The short answer
A client was receiving huge replies faster than it could read them, so Redis kept those replies in its output buffer, which grew to 2.1 GB. Client output buffers count in used_memory, so Redis evicted real cache keys to stay under the 10 GB maxmemory. I would find and kill the client with CLIENT LIST and CLIENT KILL, then prevent it with a client-output-buffer-limit for normal clients, maxmemory-clients, ACLs that block MONITOR and KEYS for tools, bounded reads with SCAN and paging, and alerts on unexpected eviction and client buffer memory.
What to remember
In this answer, we saw that client output buffers are part of used_memory, so a slow client receiving huge replies grew a 2.1 GB buffer and made Redis evict real data to stay under maxmemory. We found the client through CLIENT LIST and killed it, then put limits in place with client-output-buffer-limit for normal clients and maxmemory-clients, removed the cause with ACLs and bounded reads, and added alerts on eviction and client buffer memory.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
A client was receiving huge replies faster than it could read them, so Redis kept those replies in its output buffer, which grew to 2.1 GB. Client output buffers count in used_memory, so Redis evicted real cache keys to stay under the 10 GB maxmemory. I would find and kill the client with CLIENT LIST and CLIENT KILL, then prevent it with a client-output-buffer-limit for normal clients, maxmemory-clients, ACLs that block MONITOR and KEYS for tools, bounded reads with SCAN and paging, and alerts on unexpected eviction and client buffer memory.
Why this question is asked
This incident confuses people because nothing wrote data, yet a third of the cache vanished in minutes. Interviewers like it because the cause sits in a part of Redis memory that most developers never think about: the buffers that hold replies on their way to clients. In this answer, we will recap how replies are buffered, connect the 2.1 GB buffer to the eviction storm, find the culprit with real commands, and set the limits and rules that stop it next time.
1A Quick Recap of Client Output Buffers
When Redis executes a command, it does not wait for the client to receive the reply. It writes the reply into that client's output buffer, and the event loop sends the buffer to the socket as fast as the network and the client allow. Usually the buffer empties within microseconds.
But if a client asks for a lot of data and reads it slowly, the buffer grows. HGETALL on a hash with five million fields can produce hundreds of megabytes of reply in one command. A MONITOR session receives a copy of every command the server runs. A consumer whose thread is stuck stops reading entirely. In each case Redis keeps producing and the buffer keeps growing, and that memory is part of used_memory.
2How a Buffer Turned Into an Eviction Storm
The instance runs with maxmemory 10 GB and allkeys-lru, and normally its data sits just below the limit. At 14:05 one client's buffer grew towards 2.1 GB. used_memory rose above 10 GB, and Redis did exactly what it was configured to do: it evicted least recently used keys until used_memory was back under the limit.
Because the buffer kept growing, Redis kept evicting, at 40,000 keys per second. The key count dropped by a third, the hit rate fell from 96 to 60 percent, and the database behind the cache took the extra misses. No new data was written; the memory was taken by a reply that a client was not reading.
7 messages in order. Play them, or step through them one at a time.
Every byte in the buffer is a byte of cache data that has to go.
3Finding and Stopping the Client
CLIENT LIST shows one line per connection. The fields that matter here are omem, the output buffer memory in bytes, tot-mem, the total memory for the client, cmd, the last command it ran, age, how long it has been connected, name, if the client set one, and addr. INFO memory also has mem_clients_normal, the total for all normal clients, which confirms the scale.
Once the client is gone, its buffer is freed at once and eviction stops. The evicted keys are not coming back, of course; the cache will refill from the database over the next minutes or hours, so the team owning the database should know what is happening.
4Limiting the Damage Next Time
For normal clients, client-output-buffer-limit defaults to 0 0 0, which means unlimited. Replicas and pub/sub clients have limits; ordinary clients do not. Setting a hard limit, for example 512mb, and a soft limit, such as 256mb for 60 seconds, makes Redis disconnect any normal client whose buffer passes it. The client gets an error, but the cache keeps its data.
Redis 7.0 added a second protection, maxmemory-clients, which caps the memory of all clients together. When the total passes it, Redis disconnects the clients using the most memory instead of evicting data. Setting it to a few percent of maxmemory, or an absolute value such as 1gb, would have stopped this incident at the first gigabyte.
5Removing the Cause and Watching for It
Limits contain the damage; the cause is a client asking for too much. Through ACLs, application and tool users should not be able to run MONITOR or KEYS at all, for example by giving them -monitor -keys or excluding the @dangerous category. Tools that export data should use SCAN, HSCAN and paged ranges, so each reply is a few hundred elements rather than millions.
Finally, alerting. On an instance that normally evicts nothing, any rise in evicted_keys is a signal worth a page, and an alert on mem_clients_normal above, say, 500 MB would have fired minutes before the hit rate fell. With both in place, the next case is caught in minutes rather than found in a post-mortem.
6Follow-up questions
Why does a MONITOR session also slow the server down?
MONITOR makes Redis format every command it executes and append it to the monitoring client's output buffer. That adds CPU work to every command on the main thread, often cutting throughput noticeably, and if the monitoring client reads slowly, its buffer grows without limit for normal clients, exactly as in this incident. That is why MONITOR should be brief and is best blocked for everyone except operators.
Why not use noeviction so data is never dropped?
Then the same buffer growth would make every write fail with OOM errors instead, which for most caches is worse. The right fix is to stop clients from using that much memory, not to choose which way to fail.
Do replica output buffers count against maxmemory too?
Replica buffers and the AOF buffer are excluded from the eviction calculation (mem_not_counted_for_evict), and replicas have their own default output buffer limit, 256mb hard and 64mb for 60 seconds, after which the replica is disconnected and must resync.
7Conclusion
In this answer, we saw that client output buffers are part of used_memory, so a slow client receiving huge replies grew a 2.1 GB buffer and made Redis evict real data to stay under maxmemory. We found the client through CLIENT LIST and killed it, then put limits in place with client-output-buffer-limit for normal clients and maxmemory-clients, removed the cause with ACLs and bounded reads, and added alerts on eviction and client buffer memory.
Open with
Client output buffers count in used_memory. Some client, very likely a MONITOR session, a tool doing HGETALL or LRANGE on big keys, or a stuck consumer, was getting huge replies and reading them slowly, so its buffer grew to 2.1 GB.
Then, if they want more
With maxmemory at 10 GB and allkeys-lru, Redis evicted real keys to make room, which is why we lost a third of the keys and the hit rate fell without any new writes.
To stop it now, I would run CLIENT LIST and look at omem, cmd, age and name, confirm with mem_clients_normal in INFO memory, and remove the client with CLIENT KILL ID.
Then I would limit the damage: set client-output-buffer-limit for normal clients, because the default 0 0 0 means unlimited, and on 7.0 or later set maxmemory-clients so Redis disconnects the biggest clients instead of evicting data.
Then I would remove the cause by blocking MONITOR and KEYS for application and tool users with ACLs and making tools use SCAN, HSCAN and paging. Last, I would alert on any eviction on an instance that normally has none, and on client buffer memory, so the next case is caught in minutes.
About this answer
- Last updated
- 13 November 2026
- Versions it names
- Redis 7
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Redis documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "INFO clients shows client_recent_max_output_buffer at 2.1 GB. What happened, and how do...": https://scrivio-interview-library.netlify.app/databases/redis-internals/265c5e7744/