Skill Zuno · skillzunos.com · System Design
Hashing interview questions
Prepare for Hashing interviews on Skill Zuno. This practice book covers Hashing interview questions across New, Easy, Medium, Hard, and Diff levels so you can work through real interview-style problems on skillzunos.com.
Open Hashing on Skill ZunoAlso see the Hashing tutorial.
Hashing maps data of any size to a fixed-size value, and distributed systems use it to decide where data lives. Simple modulo hashing reshuffles almost every key when servers change, so systems use consistent hashing or rendezvous hashing instead. Interviews cover hash functions, partitioning with consistent hashing, virtual nodes and hot spots.
Sample Hashing interview questions
Why is hash mod N a problem for distributed caches?
When a server is added or removed, N changes and almost every key maps to a different server. The cache effectively empties and the database receives a sudden flood of misses.
How does consistent hashing work?
Servers and keys are hashed onto the same ring, and each key belongs to the next server clockwise. Adding or removing a server moves only the keys between it and its neighbour.
Why use virtual nodes?
With few servers, ring positions are uneven and some servers own much more data. Placing each server at many points evens out the load and spreads a removed server's keys across all the others.
Which systems use consistent hashing?
Amazon Dynamo and DynamoDB, Apache Cassandra, Riak, many CDNs and memcached client libraries use it to partition data across nodes.
How do you handle a hot key?
Cache it closer to clients, replicate it to several nodes, or split it into sub-keys such as key#1 to key#10 and combine the results when reading.
What you can practice
- Hashing interview questions for beginners and experienced developers
- Level-based practice: New, Easy, Medium, Hard, and Diff
- System Design topics alongside Hashing on skillzunos.com