System design interview questions
Design a news feed (news feed like Twitter or Instagram)
"Design a feed like Instagram's." You ask questions and learn: 30,000 req/s at the peak, 7 in 10 are photos, and 1 in 10 is a write such as a post, like or comment. Opening the feed must be fast, and posting must never make the poster wait for their followers.
Practise this roundPart of Bugpit Pro. A 30 minute timed round in your browser: draw the design, run it against the traffic, then see the interviewer's checklist.
The question
30,000 requests a second at the peak, 10% of them writes and 70% static files. You have 30 minutes and every part on offer: servers, load balancers, caches, databases, queues and more.
How the round works
Like a real interview, the canvas starts empty and the checklist stays hidden until you submit. Bugpit then sends the traffic at your design, crashes a machine, and marks what held up, what fell over and what it would cost each month.
What a strong answer covers
Show it (try the round first)
Split the traffic first. 21,000 of the 30,000 req/s are photos, which never change. Put them in object storage behind a CDN and they stop being your servers' problem.
3,000 writes a second are too many for one primary, however big. Split the data across shards, by user, so each one takes only its share.
Don't build a follower's feed while the poster waits. Put the post in a queue and let workers add it to each follower's feed in the background. Then check the queue empties after the peak.
Say out loud what this breaks: an account with millions of followers makes one post into millions of writes. For those accounts, build the feed when followers open the app instead.
The point: A feed is three systems: files at the edge, writes spread over shards, and fan out done in the background. Interviewers want to hear the celebrity problem named even if you don't solve it.
More system design interview questions
- Design a link shortener (URL shortener like Bitly)
- Design a chat app (chat app like WhatsApp)
- Design checkout for a flash sale
- Design an app for users worldwide
- Design search for a shop
- Design a notification system
- Design a photo store (photo storage like Instagram)
- Design a rate limiter
- Design a payment system