Design a Flash Giveaway
Design the backend for a fast-food chain’s app that gives away 6 million free burgers in one hour. The campaign is announced on TV; at 12:00 the button in the app turns on, and anyone with an account can claim one burger. A claim gives a coupon code (a QR code in the app) that any of the chain’s 20,000 restaurants can scan within 7 days.
About 30 million people have the app, and around 20 million will try in the first minutes. At 12:00:00 the backend sees about 1 million claim attempts a second, many from scripts, then almost nothing once the burgers are gone. The hard parts are surviving a spike hundreds of times normal traffic, never giving out burger number 6,000,001, giving each person at most one, keeping bots from taking them, and being fair to the people who tried first, all for one hour that will not be repeated if it goes wrong on live TV.
Good questions to ask first
Decide what you would assume for each before you look at ours.
- 1Must the burgers last the whole hour?
- 2Can we give out a few more than 6 million?
- 3One per what?
- 4How fast must a claim be confirmed?
- 5Is the waiting time acceptable?
- 6What happens at the restaurant?
- 7Do we need to be fair?
- 8Is this the regular ordering backend?
How to spend the 45 minutes
- 5minPart 1: Requirements and scope
- 5minPart 2: Estimates
- 5minPart 3: API
- 15minPart 4: Architecture, stage by stage
- 15minPart 5: Deep dives: stock, waiting room, failures