Whiteboard exercise. Try the problem cold, then reveal the rubric to self-score.
Out of 10 points45 min whiteboardReference solution →
01
Prompt
500M carts updated daily across every device. Never lose a cart. The hard parts: a hybrid storage layer that keeps hot carts in Redis for sub-ms reads while persisting to DynamoDB for durability, guest-to-authenticated cart merge that unions items without losing anything on login, and inventory soft-reservation with TTL that holds stock for 15 minutes without hard-locking millions of abandoned items. Amazon, Walmart, Shopify — every cart looks simple until it runs at 50K ops/sec.
Time budget: 45 min whiteboard. Draw architecture, estimate numbers, discuss tradeoffs.
02
Hints (progressive — click to reveal)
Hint 1
Lead with the hybrid storage model. "Redis for hot reads at sub-ms, DynamoDB for durable persistence, write-behind via Kafka." This shows you understand the latency-durability tradeoff at scale.
Hint 2
Guest merge is the differentiator. Most candidates forget that 40% of e-commerce traffic is unauthenticated. Explain the union strategy (keep higher quantity) and the inventory hold transfer — this is production-level detail.
Hint 3
Soft hold with TTL is the key insight. "DECR on add, TTL key at 15 min, INCR on expiry. Checkout deletes the TTL key to make the hold permanent." This single pattern prevents both oversell and dead-stock from abandoned carts.
03
Rubric — 10 points
+2 Lead with the hybrid storage model. "Redis for hot reads at sub-ms, DynamoDB for durable persistence, write-behind via Kafka." This shows you understand the latency-durability tradeoff at scale.
+2 Guest merge is the differentiator. Most candidates forget that 40% of e-commerce traffic is unauthenticated. Explain the union strategy (keep higher quantity) and the inventory hold transfer — this is production-level detail.
+2 Soft hold with TTL is the key insight. "DECR on add, TTL key at 15 min, INCR on expiry. Checkout deletes the TTL key to make the hold permanent." This single pattern prevents both oversell and dead-stock from abandoned carts.
+2 Don't forget abandon recovery. 70% of carts are abandoned. At Amazon scale that's 350M carts/day. Recovering even 5% via email is worth billions annually. Kafka event stream + idle detection is the architecture.
+2 Distinguish from flash-sale inventory. Flash sale = single atomic counter, extreme contention. Shopping cart = distributed soft holds across millions of SKUs, long-lived state. Different problem, different solution.
Self-score: tally the points you would have mentioned unprompted. 7+ is interview-ready on this problem.
04
Red flags (things that tank the interview)
Store the cart in an HTTP session cookie
Hard-lock inventory when item is added to cart
Never refresh prices — show the price from 3 days ago at checkout