Layer 3 · Go deeper · 9 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
A Flipkart-style sale month: 1 billion image views straight from S3. What’s the bill?
How many parts does a 10 GB phone video upload need?
Build-up · 6 steps
Upload a video without touching your servers
Your servers only decide who may write what, where. Follow one upload from the first request to a ready row.
Step 1 of 6
Pending row first
The phone asks to upload, and the API inserts a row with status pending before any bytes move. Every object will have an owner row, so nothing is stored that the database cannot find.
4 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 4
Interviewer
“Users upload photos and 2 GB videos from their phones. How do the bytes get into storage?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“A bucket holds 100 million photos. The app must show “user 42’s photos from last week”. How do you find them?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“Several jobs race to commit manifest 000124.json of a table stored in S3. How do you make sure only one wins?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Raw video originals are almost never re-read after the first month, but you keep them seven years. Where do they live?”
Your move. Pick an approach:
Build-up · 5 steps
Upload a 5 GB file in parts
Above about 100 MB, and always above 5 GB, one PUT becomes many. Follow 50 parts of 100 MB, three at a time.
Step 1 of 5
Start an upload
CreateMultipartUpload returns an upload ID. Use it from about 100 MB, and always above 5 GB, the single-PUT limit.