Photo Grid At Scale
Design the photo sharing service behind an Instagram-style app: people upload photos from their phones, followers see those photos in a home feed, and anyone can browse an explore page of popular photos.
Requirements
Functional: upload a photo with a caption, produce the display sizes the apps need, serve image bytes fast worldwide, return a recency-ordered feed of the accounts a user follows, and return an explore page of popular public photos by locale.
Non-functional: an upload is durable once acknowledged, image bytes are immutable once written, reads outnumber writes by roughly 100 to 1, private accounts must not have their photos readable by URL guessing, and the product degrades gracefully when the image pipeline falls behind.
Scale
- 40M daily active users out of 300M registered.
- 5M photo uploads per day, with peaks near 3x the average rate.
- Originals average 4 MB; each photo needs 4 display sizes totaling about 1.2 MB.
- 480M feed page loads per day, 20 photos rendered per page.
- The median account has 200 followers; the top 0.01% have more than 1M.
- Targets: p95 upload acknowledgment under 400 ms once the bytes land, p95 feed page under 300 ms, p95 image delivery under 100 ms at the edge, and a new photo visible to followers within 5 seconds.
Out of scope
Direct messages, stories, video, comment and like ranking models, ad serving, and moderation classifiers. Assume authentication, the follow graph writes, and the mobile clients already exist.
Sign in to answer questions and track your progress
Sign In