BLUEPRINT #02Media & Streaming
Design Google Drive File Sync & Storage
Referenced Architecture Primitives (8)
Click any primitive to study its algorithmic deep dive#02Distributed Rate Limiting#03Bloom Filters & Counting Filters#04Distributed Caching Patterns & Eviction#07Write-Ahead Log (WAL) & LSM-Trees#08Database Sharding & Partition Keys#12Change Data Capture (CDC) & Outbox Pattern#14API Gateway & Reverse Proxy#18WebSocket, Server-Sent Events (SSE) & Long Polling
10-Stage Structure:1. Requirementsβ2. Sizingβ3. Topologyβ4. Data Modelβ5. AWS Topologyβ6. Deep-Diveβ7. Failuresβ8. SRE Playbooks
1. Problem Statement & Scope
System Mission
Design an enterprise-grade, cross-platform cloud file storage and multi-device synchronization engine capable of managing billions of files, supporting content-defined chunking (CDC), block-level differential synchronization (delta sync), global data deduplication, real-time cross-device mutation push, and ACID-compliant directory namespace management.
Interactive Architecture DiagramSynthesizing vector architecture diagram...
Functional Requirements
- Hierarchical File Management: Support nested folder hierarchies, renaming, moving, and soft/hard deletions (Trash).
- Block-Level Differential Delta Sync: Split files into content-defined chunks ( average), compute cryptographic hashes (SHA-256), and transfer only modified blocks over the network.
- Global Content Addressable Storage (CAS) Deduplication: Deduplicate identical blocks across all files and users globally to minimize raw storage footprint.
- Real-Time Multi-Device Fanout: Instantly notify all connected devices (desktop, mobile, web) when files are modified, added, or deleted.
- Revision History & Conflict Resolution: Maintain granular 30-day revision history with automatic creation of "Conflicted Copies" during concurrent offline edits.
Non-Functional Requirements (SLAs/SLOs)
- High Availability: uptime SLA for file read/write APIs ( downtime/year).
- Data Durability: 11 9s () durability via Amazon S3 multi-AZ storage.
- Sync Propagation Latency: Delta sync notification delivered to online peer devices in globally ().
- Network Bandwidth Optimization: Delta sync must achieve bandwidth savings on incremental edits of large documents.
- Client Resource Footprint: Local client RAM , background CPU when idle.
Out-of-Scope
- Collaborative real-time rich-text co-authoring engines (OT / CRDT character-by-character live document typing as in Google Docs; covered in collaborative editing blueprints).
- Server-side full-content Optical Character Recognition (OCR) and deep AI semantic video indexing.
2. Capacity & Scale Estimation
Traffic & Scale Assumptions
- Total Registered Users: users.
- Daily Active Users (DAU): active users.
- Active Connected Devices: Average .
- Daily File Modifications / Sync Commits: Average .
Storage & Delta Bandwidth Math
- Average File Size: . Total user storage quota average .
- Deduplication Ratio: Content-defined chunking yields an estimated storage reduction via cross-user block deduplication.
- Delta Sync Network Bandwidth Savings:
- Without Delta Sync (Full file upload): .
- With Block-Level Delta Sync: Only 1 modified chunk uploaded per commit: .
- For small edits ( diff inside a file), delta sync reduces network payload from ( reduction).
3. High-Level Architecture & AWS Component Mapping
Interactive Architecture DiagramSynthesizing vector architecture diagram...
Component Responsibility Breakdown
| Component | AWS Technology | Operational Role & Configuration |
|---|---|---|
| Sync Control Plane | Amazon ECS Fargate | Validates commit requests, performs chunk diff calculation against server manifests, issues presigned S3 PUT URLs for missing blocks. |
| File Tree & Metadata Store | Amazon DynamoDB | Stores file hierarchy, POSIX permissions, version vectors, folder parent-child edges, and block hash list pointers. |
| Block Hash Registry | Amazon ElastiCache Redis | Fast in-memory Bloom filter + hash set indexing all existing global SHA-256 chunk keys to eliminate redundant S3 HEAD requests. |
| Content Addressable Storage (CAS) | Amazon S3 | Stores immutable binary chunks addressed by s3://drive-blocks/<sha256_hash>. Zero overwrite; protected by S3 Object Lock. |
| WebSocket Connection Manager | API Gateway WebSocket + DynamoDB | Manages 250M persistent WebSocket connection tokens mapping user_id -> connection_id with 10-minute idle pings. |
| Change Data Capture (CDC) | DynamoDB Streams + Kinesis | Guarantees ordered, durable streaming of file revision events to fanout notification workers. |
4. API Interface Design & Wire Protocols
1. Delta Sync Commit & Block Hash Negotiation
httpPOST /v1/files/sync/commit HTTP/1.1 Host: api.drive.aws.internal Authorization: Bearer <jwt_token> Content-Type: application/json { "file_id": "file_88129384bc", "base_version": 14, "file_name": "quarterly_financial_model.xlsx", "parent_folder_id": "folder_root_001", "file_size_bytes": 20971520, "chunk_hashes": [ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2", "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e", "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8", "4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a" ] }
Response: 200 OK (Only Missing Chunks Require Upload)
json{ "file_id": "file_88129384bc", "new_version": 15, "sync_action": "UPLOAD_REQUIRED", "missing_chunks": [ { "chunk_hash": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e", "presigned_put_url": "https://s3.us-east-1.amazonaws.com/drive-cas-blocks/a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e?X-Amz-Signature=..." } ] }
2. Finalize Commit Once Chunks Uploaded
httpPOST /v1/files/sync/finalize HTTP/1.1 Host: api.drive.aws.internal Authorization: Bearer <jwt_token> Content-Type: application/json { "file_id": "file_88129384bc", "new_version": 15, "uploaded_chunk_hashes": [ "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e" ] }
Response: 200 OK
json{ "file_id": "file_88129384bc", "status": "COMMITTED", "version": 15, "updated_at": 1718000500123 }
5. Data Models & Storage Architecture
Interactive Architecture DiagramSynthesizing vector architecture diagram...
DynamoDB Single-Table Schema (GoogleDriveCoreTable)
Partition Key (PK) | Sort Key (SK) | Attributes | GSI1-PK / GSI1-SK |
|---|---|---|---|
USER#<user_id> | FILE#<file_id> | name, parent_id, current_ver: 15, is_folder: false, updated_at | FOLDER#<parent_id> / NAME#<name> |
FILE#<file_id> | VER#000015 | committed_at: 1718000500, size: 20971520, chunk_hashes: [...] | β |
BLOCK#<sha256> | METADATA | s3_key, size_bytes: 4194304, global_ref_count: 842, created_at | β |
USER#<user_id> | CONN#<conn_id> | device_type: "MACOS", connected_at: 1718000000, ttl: 1718086400 | β |
Part 2: Production Deep-Dive Locked1 Coin = 24 Hours
Unlock Complete Architecture & Production Runbooks
Your Balance:40 Coins
You have explored the free architectural preview (~42%). Spend 1 Coin to unlock the remaining 6 production deep-dive sections for a full 24 hours.
Sections Included in This 24-Hour Pass:
6. Core Algorithms & Deep-Dive Workflows
7. Architectural Trade-Off Matrix & Primitive Links
8. Critical Failure Modes, Resiliency & Edge Cases
9. Production Pitfalls & Anti-Patterns (The "Top 5 Gotchas")
10. Production Runbook & Observability Guide
11. System Design Interview Rubric & Deep-Dive Strategy
Keeps page unlocked for exactly 24 hoursSpend coins to fund LLM & compute infrastructure