Design a Distributed File Storage
Design a distributed file storage system like Google Drive or Dropbox. Users should be able to upload, download, and share files of any size. Design for 500M users with 50GB average storage per user.
How the interview goes
Five phases, and questions the interviewer is likely to ask in each.
1. Requirements
- What's the maximum file size?
- How many versions of a file should we keep?
- Do we need real-time collaboration (like Google Docs) or just file sync?
Show a hintHint
Think about the difference between file metadata (cheap) and file data (expensive).
2. High-level design
- How do you handle files larger than memory?
- How do you deduplicate files across users?
- How does sync work across multiple devices?
Show a hintHint
Chunking allows resumable uploads and deduplication. 4-8MB chunk sizes are common.
3. Deep dive
- What's your chunk size and why?
- How do you implement resumable uploads?
- How does content-addressable storage work for deduplication?
Show a hintHint
Content-addressable storage (hash of content = storage key) enables automatic deduplication.
4. Scaling
- How do you achieve 11 nines of durability?
- How do you handle hot files downloaded by millions of users simultaneously?
- How does your metadata database scale?
Show a hintHint
CDNs handle hot files; replication across availability zones handles durability.
5. Trade-offs
- Strong consistency vs eventual consistency for file metadata?
- Storage cost vs deduplication complexity trade-off?
Show a hintHint
Strong consistency for metadata is critical; eventual consistency for file data sync is usually acceptable.
Practice this with an AI interviewer
Write your design doc with live diagrams while the interviewer asks one question at a time and pushes on your choices. Get a scored debrief with what to study next.
Start this interview