Hello Interview (@_hellointerview) header
Hello Interview (@_hellointerview) profile picture

Where top software engineers prepare for interviews

Joined May 2023
Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)Photo by Hello Interview (@_hellointerview)
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…
89
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
149
With hash(key) modulo N, N is the number of servers. Going from three servers to four changes the calculation for every key, and many keys get a different owner. Suddenly a routine capacity increase means widespread data movement.
1
157
Adding one server to your cache cluster can reshuffle most of its keys. Consistent hashing avoids that. Here's how.
1
22
1,335
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
749
A virtual waiting room controls how many people reach checkout. More booking servers alone won’t fix millions of users competing for the same few seats.
1
2
1,308
Reserve seats for a few minutes while the user pays. An expiring Redis lock avoids holding a database transaction open through checkout. The final booking still needs a database concurrency check.
1
4
1,647
Search can tolerate stale data. Selling the same seat twice cannot. Give browsing and booking different consistency guarantees instead of forcing one policy on the whole system.
1
1
10
2,095
Ticketmaster System Design
5
37
742
36,363
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
380
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,158
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
Bloom filters do the same trade for membership. Definitely not in the set, or probably in it, with no false negatives ever.
1
3
523
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.
1
1
47
2,852
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
It is not queryable and it has no transactions. What it gives you is cheap durable bytes at any size, and a URL you can hand to a CDN.
1
4
843