Shopify · Inventory Reservation at Scale

Shopify Advanced #databases#concurrency#mysql#transactions

Shopify · Inventory Reservation at Scale

How Shopify stops the last item selling to two people at once — and why the fix evolved from a Redis counter to per-unit rows with SKIP LOCKED. Run a flash sale and watch each design break.

Note: this is an illustrative client-side model — the numbers teach the why, they aren't from a real database.

Buyers
0 processed
Reservation store
Inventory (truth)
2
units in MySQL
0Correct sales
0Oversold
👻0Phantom stock
Throughput (chk/s)
p99 latency (ms)
🗃️1Reservation rows
Pick a step below, or hit Run flash sale.
Step 1 / 6

Run this simulator free

Sign in once to unlock every simulator. Takes 20 seconds.