Skip to content

Case study: Instagram (photo sharing)

Design photo sharing: a CDN carries the views, an object store keeps originals, async workers make every size, and time-ordered shard-aware IDs organise the metadata.

35 min9 steps

By the end you can
  • Estimate storage growth, egress and origin load from the CDN hit rate
  • Design an upload path that acknowledges fast and processes asynchronously
  • Explain Instagram's 64-bit IDs and why sharding by user suits photo metadata
  • Predict the effect of a CDN outage, an upload spike and a slow object store

Requirements

Features

  • Captioned uploads, multiple sizes, user photo lists

Targets

  • Global views p99 <200 ms; durable uploads within seconds

Workload

  • Hundreds of views/upload; thumbnails may lag

What should 'upload complete' mean to the user?

Answer this step to continue.

What this lesson simplifies

  • The simulated CDN is one edge; per-region caches and origin shields across many edges are discussed only.
  • The DNS TTL is 300 ms so failover fits in a 3-second run; real TTLs are 30–300 s and resolvers may hold records longer.
  • Every request enters through the CDN; uploads pass through to the origin, as CDNs proxy uncacheable requests.

Sources

  1. Instagram Engineering. Sharding & IDs at Instagram, 2012.
  2. D. Beaver, S. Kumar, H. C. Li, J. Sobel, P. Vajgel. Finding a needle in Haystack: Facebook's photo storage, 2010.
  3. S. Muralidhar et al.. f4: Facebook's Warm BLOB Storage System, 2014.

Reviewed by Content lead on . Revision 1.