Photo Sharing (Instagram) System Design
Upload photos and browse a feed of images from people you follow.
About this problem
Design an Instagram-style photo sharing app. People upload photos, follow other accounts, and scroll a feed of recent photos from the accounts they follow. Tapping a photo opens it at full size.
The feed has to load quickly for every user, and every photo has to open reliably at full quality. Uploads must never be lost.
Image downloads are almost half of all requests, feed loads are about half, and uploads are the small remainder. The app is launching in a new region, so traffic ramps from zero to about 8,000 requests per second.
Requirements
- Upload a photo with a caption.
- View a feed of recent photos from followed accounts.
- Open any photo at full size.
Scale targets
- Image downloads make up almost half of all traffic.
- Traffic ramps from zero to peak as a new region launches.
Traffic
Ramp, 0 to 8,000 TPS. The simulator sets this traffic up for you when you start the problem.
CAP trade-off
A feed that's a few seconds behind is fine. A feed or photo that won't load is not.
Practice it
Build it on the canvas, run the traffic, and get scored.
Related problems
- News Feed (Twitter Timeline) System Design
Show each user a timeline of posts from the accounts they follow.
- URL Shortener System Design
Turn long URLs into short codes and redirect visitors fast.
- Pastebin System Design
Let people store text snippets and share them by link.