~learn.
0:00 / 1:08
Side quest 34 · Amazon Prime Day

5,000 writes a second on one row. No split can save it.

transcript

Say a headphones deal has 20,000 units, and 150,000 people want one. At the start, 5,000 a second hit one stock counter.

That counter is one item, sitting on one partition. In the DynamoDB paper's example, a partition maxes out at 1,000.

Can't DynamoDB split the hot partition? It can, in minutes. But a partition hit hard on one item won't benefit.

So split the item yourself. 20 sub-counters of 1,000. Each on its own key. About 250 writes a second each. A buyer takes one only if at least 1 is left.

But here's the catch. Why can't it oversell? No sub-counter ever goes below zero. And together they add up to exactly 20,000. No lock needed.

One more trap. On-demand tables absorb double their old peak. Expecting more? Load-test to your peak before the day.

A bigger database won't save you from one hot item. Fix it in the data model.

Full breakdown in the lecture.