Adding one server to your cache cluster can reshuffle most of its keys. Consistent hashing avoids that. Here's how.
1
18
1,108
Consistent hashing puts servers and keys on a ring. A key belongs to the first server clockwise from its position. Adding a server takes over only the interval before that server; keys elsewhere keep their owners.
1
130
Virtual nodes place each physical server at many points on the ring. This helps distribute data more evenly and spreads a failed server's ranges across several surviving machines. The full visual walkthrough: hellointerview.com/twitter/c…
74
Cache event details and use Elasticsearch for discovery. Treat the seat map as a hint: availability can change between viewing a seat and trying to reserve it.
1
2
746
Read the full breakdown:
hellointerview.com/twitter/t…
5
514
A binary tree is nodes with at most two children. Root at the top, leaves at the bottom, height is the longest path between them. That is the whole vocabulary.
1
25
1,156
Almost every tree question is then the same move: ask what each node needs from its children, and let recursion carry it up.
1
1
379
Starting from maximum depth, which is that pattern at its smallest: hellointerview.com/twitter/m…
106
Counting unique visitors with a set costs memory proportional to the visitors. HyperLogLog answers the same question in kilobytes, and gets it slightly wrong on purpose.
Count-Min Sketch handles frequency the same way. All three swap exactness for space, which is only a good deal when you know the error you are buying.
1
4
336
When approximate is the right answer at scale, and when it quietly is not: youtube.com/watch?v=IgyU0iFI…
1
264
Every design with a photo, video or document in it eventually needs blob storage, and the mistake is treating it as a database that happens to hold files.
1
36
2,293
So the metadata lives in your database and the bytes live in S3, and the interesting question is how the two stay in step when one write succeeds and the other does not.
1
4
588
The full pattern, including presigned uploads and CDN delivery: youtube.com/watch?v=RvaMHMxH…
2
335


