39. Design File Storage and Sync (Google Drive / Dropbox)
1
The interview prompt2
39.1 What do you ask first?3
39.2 How big is this, really?4
39.3 What are the doors?5
39.4 What do we store?6
39.5 What does the whole system look like?7
39.6 How does chunking work?8
39.7 How does de-duplication work?9
39.8 How do sync and conflicts work?10
39.9 How is the metadata database designed?11
39.10 How do presigned uploads work?12
39.11 What would you say in the last five minutes?13
Score yourself14
Variations to practise15
Sources16
Code lab39. Design File Storage and Sync (Google Drive / Dropbox)
Score yourself
3 min read+10 XP
Score yourself
Give yourself 0, 1 or 2 points per row.
| Area | 0 points | 1 point | 2 points |
|---|---|---|---|
| Requirements | Started drawing | Upload and download | Sync, sharing, history, big files and conflicts agreed |
| Estimates | None | Numbers, not used later | Exabytes → object storage, rows → sharded metadata, bandwidth → direct uploads |
| API and data | Skipped | Upload API only | Check-missing, presigned upload, commit with base version, changes cursor |
| High-level design | Files through app servers | Storage + DB, no sync | Upload, commit, notify and sync walked |
| Deep dive | Hand-waved | One topic | Chunking with CDC, dedupe, conflicts or metadata sharding done properly |
| Trade-offs | None named | Named when asked | Raised unprompted (fixed vs CDC, cross-user dedupe privacy, conflict copies) |
| Communication | Long silences | Mostly clear | Thought out loud, checked in, managed time |
12 to 14: strong hire signal. 8 to 11: solid, polish the weak rows. Under 8: redo the round in a week, timer on.
The bar: fresher vs SDE-2
| Fresher | SDE-2 | |
|---|---|---|
| Storage | Files in S3, paths in a DB | Content-addressed blocks, file = list of hashes, versions for free |
| Transfer | Upload the whole file | Upload only missing blocks, resumable, presigned and multipart |
| Sync | Poll for changes | Journal + cursor per device, long-poll notifications |
| Conflicts | Last write wins | Compare-and-set on base version, conflicted copies |
| Scale | One database | Sharded by namespace, hot folders, GC of unreferenced blocks |
Common mistakes
- Streaming file bytes through the app servers.
- Re-uploading whole files for small edits.
- Last write wins, silently losing an offline edit.
- Polling every device every few seconds instead of notifications plus a cursor.
- Deleting blocks still referenced by older versions or other files.
Quick check
Five questions on this chapter. Pick an answer, then check it.
quiz