Consistent Hashing hard
Consistent Hashing usually breaks multi-key transactions because `user:1` and `user:1:orders` might hash to different nodes. How do 'Hash Tags' `{...}` solve this?
- A They force the database engine to implement across-node distributed locking for all multi-key operations to ensure ACID compliance.
- B They utilize a secondary global index that maps all related keys to a single authoritative 'master' node within the cluster topology.
- C They tell the hasher to only process a specific substring of the key, guaranteeing that related items land on the same hash slot.
- D They implement a dedicated high-speed synchronization bus that mirrors all related data across every node in the local data center.
Answer: C. They tell the hasher to only process a specific substring of the key, guaranteeing that related items land on the same hash slot.
Consistent Hashing normally shatters data: `user1:profile` and `user1:posts` would likely hash to different nodes, making atomic multi-key operations impossible. 'Hash Tags' (e.g., `{user1}:profile` and `{user1}:posts`) force the hasher to only look at the part inside the curly braces. Since the input to the hash function is now identical (`user1`), both keys are guaranteed to land on the same node, enabling local transactions.
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?