System Design (50 Qs)•Part 2: Real-World High-Scale Architecture Problems (11 - 25)
Design a Cloud File Storage & Synchronization Service (Google Drive / Dropbox).
In Simple Words: Allow users to upload, download, and synchronize files of arbitrary size across desktop and mobile devices with automatic delta sync and data deduplication.
Core Innovations:
- Chunking (Delta Sync): Files are divided into 4MB chunks. When a user edits a 500MB document, only the modified 4MB chunks are re-uploaded, saving 99% bandwidth!
- Content-Addressable Storage: Each chunk is named after its SHA-256 hash. If multiple users upload the identical file, only one physical copy is stored in object storage (Global Deduplication).
Architecture Flowchart
flowchart TD
Client["Client App"] --> ChunkEngine["Chunking Engine (4MB Chunks)"]
ChunkEngine --> Hasher["SHA-256 Hash Generator"]
Hasher --> MetaSvc["Metadata Service (PostgreSQL)"]
MetaSvc -->|"Check if Chunk Exists"| S3["AWS S3 / GCS Object Storage"]
Hasher --> S3