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.
How much raw data lands every year?
How many leaderboard writes a second at peak?
Can the segment index fit in memory?
Build-up · 6 steps
Build the high-level design
One functional requirement at a time, ending with a design that works before any scaling.
Step 1 of 6
Upload, even hours later
The Upload API does as little as possible. It hashes the file, stores the raw bytes, enqueues a message and returns 202. A retry carries the same hash and gets the same upload ID.
6 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 6
Interviewer
“Sunday morning, uploads hit five times the average. How do you absorb that without losing or duplicating any?”
Your move. Pick an approach:
Deep dive 2 of 6
Interviewer
“Assume 40 million user-drawn segments. How do you find the few this run crossed?”
Your move. Pick an approach:
Deep dive 3 of 6
Interviewer
“Efforts change thousands of times a second, from uploads, crops, deletes and privacy settings. How do you keep every board exactly right?”
Your move. Pick an approach:
Deep dive 4 of 6
Interviewer
“Every activity has thousands of GPS points. Where do the streams of a billion activities live?”
Your move. Pick an approach:
Deep dive 5 of 6
Interviewer
“Product wants a global heatmap of everywhere people run and ride. How do you build it?”
Your move. Pick an approach:
Deep dive 6 of 6
Interviewer
“You publish a global heatmap built from public activities. How do you make sure it exposes nobody?”
Your move. Pick an approach:
Build-up · 8 steps
Follow one Sunday run through it
The upload path is short and synchronous. Everything after the 202 consumes an event, so each part scales, fails and catches up on its own.
Step 1 of 8
Accept
The phone posts the FIT file. The Upload API checks the hash, stores the bytes, publishes to the uploads topic and returns 202 in about 150 ms.