Scalable Image Gallery with CDN
Design a highly scalable and performant image gallery application capable of serving millions of images to a global user base. This problem focuses on the backend system architecture for efficient storage, processing, and delivery of user-uploaded images, leveraging Content Delivery Networks (CDNs) to ensure low latency and high availability for a frontend client.
Users can upload their photos to a personal gallery. Once uploaded, these photos should be viewable quickly in various sizes (thumbnail, medium, full-resolution) by the user and potentially shared with others. The primary goal is a smooth, fast browsing experience, even with a vast number of images and concurrent global users.
Constraints
Requirements
1.
Design a robust image ingestion pipeline that handles uploads, generates multiple image derivatives (e.g., thumbnail, medium, full-resolution), and stores them durably.
2.
Propose a storage solution for both original images and their derivatives, ensuring high availability and cost-effectiveness for petabytes of data.
3.
Detail the integration of a CDN to serve images globally, including strategies for caching, cache invalidation, and handling cache misses.
4.
Define API endpoints for uploading images and retrieving specific image versions by ID, considering parameters for resolution/format.
5.
Explain how the system scales to support 100M users, 10B images, and 100K QPS read requests, maintaining low latency.
6.
Discuss mechanisms to ensure high availability (99.99%) and fault tolerance across the image serving pipeline.
7.
Outline strategies for cost optimization related to storage and CDN bandwidth.
Design Brief
You are tasked with designing the core backend system that powers a global image gallery application. This system will enable frontend clients to upload, store, and efficiently view images. The critical requirements are high scalability, low latency for image retrieval, and cost efficiency for a global user base.
Consider the entire lifecycle of an image:
Your design should cover:
Focus on the backend and infrastructure, assuming a frontend client consumes your APIs.
Loading editor...