Design Instagram: media upload, CDN, and feed ranking
Naïve Start: How Instagram Stored Photos in 2010
Instagram launched in October 2010 and went viral overnight — 25,000 users on day one. Their MVP stored photos as binary blobs directly in the Database. It worked in the hackathon. It broke in production.
Request Flow
Client uploads photo
The Poster client sends a POST request with the image bytes in the body. The API receives the full payload — blocking a request thread for the entire transfer duration.
POST /api/photos Content-Type: multipart/form-data Body: <2 MB raw bytes>
Why We Need This
Databases are optimised for structured, indexed, transactional data. Storing binary blobs in them causes: row-level bloat slowing all queries, replication lag as 2MB rows are synced, and expensive per-row DB reads for every image view.
Key Insight
Databases are not file systems. A 2 MB image row is 200× larger than a typical user-profile row. Mixing blobs with relational data degrades every operation — backups, vacuums, queries — not just photo reads.
Step 1 of 7
