Design an Image CDN for Instagram Feed Photos With Tiered Caches
Last updated: November 29, 2026
Quick Overview
Design how Instagram serves billions of feed photo requests per day through edge caches, regional caches, and origin storage, including choosing image sizes per device and keeping hit rates high.
Meta
November 29, 20260
0
0 solved
Design how Instagram serves billions of feed photo requests per day through edge caches, regional caches, and origin storage, including choosing image sizes per device and keeping hit rates high.
Photo delivery is core to Instagram, and Meta runs its own edge network, so this tests caching hierarchy reasoning at huge scale. The interviewer checks request routing to edge points of presence, cache key design for resized variants, hit rate and long-tail trade-offs, and protection of origin storage.
What the Interviewer Expects
- Lay out edge PoP, regional cache, and origin tiers with their roles
- Design cache keys that include size and format variants
- Discuss popularity skew, long tail, and eviction policies
- Use request collapsing to protect origin
- Pick image formats and sizes per device and network
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- Where should resizing happen: at upload or on demand?
- How would you improve hit rate for old photos that suddenly go viral?
- How do you handle a photo deletion when copies sit in many caches?
- How do you measure CDN performance from the client's view?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: clients request a photo by id and desired width; the CDN returns the best variant (WebP or AVIF where supported, JPEG fallback). Deleted or private photos must stop being served quickl...
High-Level Design
Clients receive photo URLs from the feed API, pointing at a CDN hostname. DNS or anycast routes them to the nearest edge PoP (including caches embedded in ISPs). Edge misses go to a **regional ori...