Redis hard
The Redlock algorithm requires acquiring locks on N independent Redis masters. Why is N strategically choosing to be an odd number (e.g., 5)?
- A To prevent split-brain by ensuring there is no possible mathematical tie in the node-level acquisition process.
- B To enable majority consensus (Quorum); requiring (N/2)+1 locks ensures the lock remains valid despite partial node failure.
- C It is a performance optimization that leverages the CPU's inability to handle even-numbered bitmask operations.
- D Even-numbered cluster configurations are strictly unsupported in the native Redis cluster messaging protocol.
Answer: B. To enable majority consensus (Quorum); requiring (N/2)+1 locks ensures the lock remains valid despite partial node failure.
If N=5, you need 3 locks. If 2 Redis nodes die, the algorithm still works. If N was even (e.g., 2), a single node failure (50%) would prevent you from reaching a 'Strict Majority', making the lock dangerously sensitive to downtime.
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?
- Why does Redis proactively disconnect a Pub/Sub client that exhibits high 'output buffer' usage relative to its ingestion rate?
- How does a 'Sorted Set' (ZSET) manage its internal membership and ordering differently from a plain Set?