azure
System Design
intermediate
Photo and video social sharing

Instagram Photo Sharing System

Instagram / Meta

Instagram processes hundreds of millions of photo and video uploads daily, each requiring multiple resize operations, filter application, and CDN distribution. This Azure-native architecture separates the upload pipeline (receive → process → store multiple sizes) from the feed pipeline (aggregate → rank → serve). Azure SQL manages follower relationships, while a stories subsystem handles ephemeral 24-hour content with Cosmos DB TTL-based expiry.

Data Flow

Azure CDN
Upload API
Processing Queue
Feed Service
Stories Service
Image Resizer
Photo Storage
Social Graph DB
Feed Cache

Share this architecture with your network

Service Breakdown (9 services)

Other9 services
Azure CDN
  • Routes application traffic with L7 rules
  • Supports WAF and SSL offloading
  • Integrates with backend pools for scaling
Upload API
  • Exposes backend services through managed API endpoints
  • Enforces authentication, throttling, and quotas
  • Provides developer portal and API analytics
Feed Service
  • Assembles photo feeds from followed accounts
  • Ranks posts by engagement and recency signals
  • Supports infinite scroll with cursor-based pagination
Stories Service
  • Hosts web applications with built-in auto-scaling
  • Supports deployment slots for blue-green releases
  • Integrates with Azure DevOps for CI/CD pipelines
Photo Storage
  • Stores original photos and generated thumbnails
  • Supports CDN integration for fast global delivery
  • Manages storage lifecycle for older media
Social Graph DB
  • Runs managed SQL databases with built-in intelligence
  • Supports elastic pools for multi-database efficiency
  • Handles automated patching and geo-replication
Feed Cache
  • Caches frequently accessed data in-memory
  • Reduces database round-trips and latency
  • Supports TTL-based expiration policies
Processing Queue
  • Provides reliable enterprise message brokering
  • Supports topics and queue-based messaging
  • Guarantees at-least-once delivery
Image Resizer
  • Executes event-driven functions without managing servers
  • Scales based on event volume with consumption billing
  • Supports durable functions for stateful workflows

Scaling Strategy

Image processing scales via Service Bus-driven Azure Functions that resize uploads into multiple dimensions in parallel. Blob Storage stores all image variants with Azure CDN edge caching for global delivery. Feed generation uses a pre-computed approach with Redis Cache storing materialized feeds. Azure SQL handles the social graph with read replicas. Stories use Cosmos DB with TTL-based automatic expiry.

Related Architectures