Design Lightning Deal Inventory That Never Oversells
Last updated: November 29, 2026
Quick Overview
Design the backend for time-limited lightning deals where a few thousand discounted units of an item go on sale at a fixed time to millions of shoppers, guaranteeing no overselling, fair access and a fast response.
Temu
November 29, 20260
0
0 solved
Design the backend for time-limited lightning deals where a few thousand discounted units of an item go on sale at a fixed time to millions of shoppers, guaranteeing no overselling, fair access and a fast response.
Lightning deals are one of Temu's signature promotions and produce extreme, spiky write contention on a single SKU. The interviewer checks that you separate the hot inventory counter from the order database, handle unpaid reservations, and degrade gracefully instead of falling over at 10:00:00.
What the Interviewer Expects
- Estimate the spike (reads and claim attempts per second at deal start)
- Keep the hot stock counter out of the relational database
- Use atomic decrement with reservation and timeout release
- Make order creation asynchronous and idempotent
- Add admission control, bot defenses and static pre-rendering
- Reconcile counters with the source of truth
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you shard the counter if a single Redis key becomes the bottleneck?
- What happens to stock reserved by users who never pay?
- How do you keep the page from showing 'in stock' after it sells out?
- How do you test this before the first big event?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: show deal page and countdown, let a user claim one unit, then pay within N minutes, release unpaid stock, show sold out. Non-functional: zero oversell, per-user limit, p99 claim under 200 ...
High-Level Design
Static deal pages and countdown served from CDN, with the server clock exposed so clients do not open early. Claim path: gateway (auth, token bucket per user and device, bot score) then a deal service...