Consistent Hashing hard
In a 'Token Aware' driver, the client sends the query directly to the owner. What happens if the ring topology changes (a node moves) while the request is in flight to the 'old' owner?
- A The request immediately fails with a '404 Not Found' error, and the client must wait for a centralized metadata refresh to occur.
- B The old owner processes the request anyway to prevent latency, and then attempts to synchronize the change with the new owner asynchronously.
- C The request hangs indefinitely within the cluster's network fabric until the gossip protocol achieves a state of perfect global convergence.
- D The old owner acts as a temporary coordinator, forwarding the request to the new owner and signaling a metadata update to the client.
Answer: D. The old owner acts as a temporary coordinator, forwarding the request to the new owner and signaling a metadata update to the client.
Because cluster topology is eventually consistent, a 'Smart Client' might have a slightly stale Ring Map. If it sends a request to the 'wrong' (old) owner, that node recognizes it is no longer the primary for that range. Instead of erroring out, it forwards the request to the correct node and sends a 'hint' back to the client to update its local routing table. This ensures seamless operation during cluster resizing.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- In a 'Smart Client' architecture (e.g., modern Cassandra drivers), how does the client find the right node?
- When a new node (Node X) joins the ring, where does it acquire its initial data from?
- Google's Maglev hashing algorithm (used in their Network Load Balancers) differs from standard Consistent Hashing rings. How does it generate the lookup table?
- Virtual Nodes improve balance but increase metadata size (Memory). How does 'Multi-Probe Consistent Hashing' achieve good balance without VNodes?
- In the Chord DHT protocol (a P2P consistent hashing implementation), naive lookups are O(N). How does Chord optimize this to O(log N)?
- Which of these systems is a famous user of Consistent Hashing?