~learn.
0:00 / 1:23
Side quest 27 · Flipkart

5,000 phones, 300,000 taps, ten seconds

transcript

5,000 phones. 300,000 people tap Buy now in ten seconds. Who gets one? And how do you never sell phone 5,001?

The obvious way? Every tap hits the stock row. 30,000 writes a second. Only 5,000 can ever succeed. So 98 percent queue on one row, just to hear no.

But here's the catch. Who wins if you take whoever arrives first? Fibre in a metro beats 4G in a small town. And the bots. So every tap in the first two seconds counts as simultaneous. Then they're drawn in random order.

One per customer, device and address. Each extra phone needs a new verified account. Then a signed token, bound to you. Valid three minutes. No tokens left? You're told you're in line. In seconds, not a spinner. All used? Sold out, published once on the CDN.

Wait. 6,500 tokens for 5,000 phones? Isn't that overselling? No. Some holders won't pay. A token only lets you try. The stock hold checks the real count. Unused tokens admit the next in line.

Don't put six million browsers in a waiting room. Put a line around one button.

Full breakdown in the lecture.