Design a flash sale with a live stock counter
PremiumReal-timeEasy
- Inventory reservation
- Thundering herd
- Server time sync
Quick answer
This real-time interview question asks you to design a flash sale with a live stock counter. Aim for a design that delivers updates to many users with low delay, then explain connections, fan-out, ordering and trade-offs. Interviewers want to see how you keep latency low, handle reconnects and stay correct under load.
The problem
Design the real-time part of a flash sale with a live stock counter, like a Flipkart or Amazon deal. 10,000 units go on sale at exactly 12:00:00 while 8 million shoppers watch a countdown and then press buy; the countdown must match on every device, the counter must feel live, and the sale must never oversell.
Before the start, millions of shoppers stare at the countdown; after it, they see units left and press buy. Checkout and payment are handled by an existing order system that can accept at most 2,000 orders per second.
What must a flash sale with a live stock counter do?
- Countdown: Every device shows the same remaining time to within 1 second, and the buy button becomes active at 12:00:00 server time, not device time.
- Stock counter: Shoppers see units left, updated at least every second while stock changes.
How well must it do it?
- No overselling: Reservations never exceed 10,000 (plus released ones).
- Burst: 5 million shoppers press buy within the first 3 seconds.
What scale should you design for?
Use these numbers in your estimates.
The scale numbers unlock with this questionUnlock
Key concepts
- Inventory reservation
- Thundering herd
- Server time sync
- Approximate counters
- CDN broadcast
- Rate limiting
How you’ll practise
- Requirements
- Estimate
- Connections
- Message flow
- Delivery guarantees
- Wrap-up
Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.
What do interviewers look for?
In any real-time design round.
- Clarifies latency, ordering and delivery guarantees
- Chooses a connection model with reasons
- Explains fan-out to many receivers
- Handles reconnects, missed messages and duplicates
- Plans for hot spots and sudden traffic spikes
- States trade-offs between consistency and speed
Questions people ask about this interview question
- Which design type is this question?
- It is a real-time question. You design a flash sale with a live stock counter and explain your choices the way you would in an interview.
- Is this question asked at entry level?
- It is marked Easy, so it suits engineers who are new to real-time interviews. It is also a good warm-up before harder questions.
- What should I cover first?
- Start with who sends and receives updates, how fast they must arrive and what order matters. Agree on scope with the interviewer before you design anything.
- Can I practise it for free?
- It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.
Related questions
Updated · Written by the SevyDevy team