System Design: Global UGC Photos and Short Videos Store/Delivery
Context
Design a globally distributed system to store and deliver user-generated photos and short videos. The system must support billions of users, high write/read throughput, multi-region presence, and strong reliability/security guarantees. Assume mobile and web clients; traffic is worldwide with regional peaks and diurnal patterns.
Functional Requirements
-
Uploads
-
Single-part and multipart uploads (for large videos, unstable networks).
-
Reads/Downloads
-
Range requests; CDN acceleration; thumbnails and transcoded variants.
-
Delete
-
Soft delete with retention; hard delete; privacy-compliant erase.
-
List
-
List by user/album with pagination and sort (time, size).
-
Derived media
-
Thumbnail generation for images; transcode videos to multiple bitrates/resolutions.
-
Search
-
Simple search by owner and metadata (filename, tags, mime, created_at).
-
Signed access URLs
-
Time-bounded, scoped URLs for upload and download.
-
Quotas
-
Per-user size/object-count quotas; enforcement on upload.
Non-Functional Requirements (address explicitly)
-
Durability targets (e.g., 11 9s), availability/SLOs.
-
Multi-region data layout and replication strategy.
-
Consistency model (metadata vs. object data) and read-after-write behavior.
-
CDN integration and cache invalidation.
-
Security: encryption in transit/at rest, key management.
-
Access control and authorization.
-
Abuse prevention and rate limiting.
-
Cost model and lifecycle policies (tiering, retention, cold storage, deletion).
-
Background processing semantics (idempotency/exactly-once behavior).
-
Metadata schema and indexing strategy.
-
Observability (metrics, tracing, audit logs).
-
Backfill/migrations approach.
-
Disaster recovery and regional failover.
-
Performance targets (p95/p99) and bottlenecks.
-
Testing and rollout plan.
Deliverables
-
API sketch (major endpoints for uploads, reads, listing, search, delete, signing).
-
Component diagram (textual/ASCII description acceptable).
-
Storage choices (object store vs. block/file; metadata store).
-
Capacity planning with rough numbers and assumptions.