Consistent Hashing medium
If you need to perform a 'Full Table Scan' on a dataset distributed via Consistent Hashing, how do you do it efficiently?
- A Send the query to a single random node in the cluster, as every participant is guaranteed to have a full global view of all data.
- B Perform a 'Scatter-Gather' operation, where the client queries all nodes in parallel and merges the results locally.
- C Consult a secondary global index that is strictly synchronized across all child data centers using a Paxos-based consensus protocol.
- D Iterate through every possible hash value in sequence until all valid keys have been successfully identified and retrieved.
Answer: B. Perform a 'Scatter-Gather' operation, where the client queries all nodes in parallel and merges the results locally.
Consistent Hashing optimizes for 'Point Lookups' (finding a specific key). However, because data is sharded across many nodes, no single node knows everything. Performing a full scan requires querying every shard in the cluster. This 'Scatter-Gather' pattern is significantly slower and more resource-intensive than point lookups, as the total latency is dictated by the slowest responding node.
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?