SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 03
Design a photo sharing app
Someone takes a photo on their phone, adds a caption and posts it. Their followers open the app later and scroll a home feed of recent posts from everyone they follow, with images that load as fast as they scroll.
Requirements
- Upload a photo with a caption from a mobile app and publish it as a post.
- Follow and unfollow other accounts.
- Show a home feed of recent posts from followed accounts, newest first, paginated.
- Show a profile grid of one account's posts.
Constraints and assumptions
- 200 million daily active users; 50 million new posts a day, peaking at about 2,000 posts per second.
- Originals average 3 MB from the phone; the app displays 4 sizes (150 px thumbnail up to 1080 px).
- Each active user opens the feed about 20 times a day; feed metadata p99 under 300 ms, not counting image download.
- The median account has 200 followers; a few thousand accounts have over 10 million.
- A new post should reach followers' feeds within 10 seconds for ordinary accounts.
Out of scope for the first sketch
Video and stories · Ranking the feed (keep it reverse-chronological) · Comments, likes and direct messages
Draw your design
Rough math and notes
SYSTEM DESIGN SKETCHBOOK / FOLLOW-UPS
Design a photo sharing app
Finish your first sketch before answering these. Cross out freely.
- A user on a weak mobile connection uploads a 12 MB photo and the connection drops at 80%. What happens next?
- Where do the smaller image sizes come from, and what does a follower see if they open the post before those sizes exist?
- An account with 80 million followers posts a photo. How does that post reach their followers' feeds?
- A user unfollows someone. Do that account's posts disappear from the feed, and how quickly?
- A photo goes viral in a region far from where it was uploaded. How do the image bytes reach those viewers fast, and what does that cost?
Compare afterwards: worked approaches and reading at sketchbook /questions/photo-sharing-app/review