Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 42

Design a giveaway for 6 million free items in one hour

Advanced · 40 min · Transactions & inventory

A restaurant chain announces during a TV broadcast that the first 6 million people to claim in its app get a voucher for a free burger, redeemable at any of its 20,000 restaurants over the next 30 days. Claims open at noon. People will hammer the button, retry, reinstall and try every trick to get more than one.

Requirements

  • A signed-in user can claim at most one voucher.
  • Never issue more than 6 million vouchers in total; every voucher has a unique code.
  • A user who got a voucher sees the same voucher after a crash, retry or reinstall.
  • Users who miss out are told quickly and clearly instead of waiting on a spinner.
  • Restaurants validate and redeem each voucher exactly once at the counter.

Constraints and assumptions

  • 6,000,000 vouchers; about 30 million users expected to try in the first 10 minutes.
  • Up to 500,000 claim requests per second in the first minute, including retries, then falling off.
  • Claim responses within 2 seconds at p99, or an honest "you are in line" with a position.
  • Expect organized abuse: scripts and farms of thousands of fresh accounts.
  • Redemption peaks at about 3,000 per second during lunch hours over the following weeks.

Out of scope for the first sketch

The marketing landing page and TV integration · Restaurant point-of-sale internals beyond a redeem API · Follow-up marketing campaigns

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches