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.
What if pricing and inventory run in Singapore instead?
How many calls hit the dependencies at the sale peak?
Parallel instead of batched. How long, and how risky?
Build-up · 6 steps
Fix one cart page, step by step
An 80-item cart that calls pricing and inventory once per line. Count it, batch it, keep the batch lean, then fix the write path too.
Step 1 of 6
The loop
Each of 80 lines awaits a pricing call, then an inventory call. Every call pays the full round trip, so the page waits 240 ms for 16 KB of data.
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
“Each cart line calls pricing and inventory, awaited one by one, so 80-item carts take 240 ms. What do you change?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“A product page reads 50 keys from a Redis cluster, one GET at a time. How do you cut the round trips?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“After batching, the cart calls /products?ids=… and gets full product objects for all 80 items. Pages got heavier. What now?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“An order service inserts one row per event in autocommit, thousands a second. How should it write them?”
Your move. Pick an approach: