Redis hard
Why does Redis proactively disconnect a Pub/Sub client that exhibits high 'output buffer' usage relative to its ingestion rate?
- A To mitigate potential SQL injection attacks that could be embedded within the malicious subscriber's metadata packets.
- B To prevent a slow consumer from consuming all server RAM and triggering an Out of Memory (OOM) crash.
- C To optimize global network bandwidth by prioritizing clients that are geographically closer to the primary data center.
- D It is an internal bug related to the epoch-based synchronization of secondary notification channels in Redis 5.0+.
Answer: B. To prevent a slow consumer from consuming all server RAM and triggering an Out of Memory (OOM) crash.
Redis buffers outgoing messages for clients. If a publisher is very fast and a client is very slow, the buffer in the server's RAM grows infinitely. Redis kills the client to protect the rest of the database's health.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- If the Redis memory limit is reached, what specific behavior is exhibited by the `allkeys-lru` eviction policy?
- What is the defining characteristic of a Redis 'Set' data type compared to a standard Redis 'List'?
- In the context of Redis messaging, what is the functional definition of the 'Pub/Sub' feature?
- How does the Redis background snapshotting process (`BGSAVE`) leverage the operating system's `fork()` mechanism to minimize memory overhead?
- How does a 'Sorted Set' (ZSET) manage its internal membership and ordering differently from a plain Set?
- Which basic Redis command is used to store or update a simple String value associated with a specific key?