Chapter 2: Shopee Flash Sale Engine — Redis Lua & Zero Overselling

Previous Chapter: Chapter 1 — Microservices Foundation | Series Hub | Next Chapter: Chapter 3 — Traffic Shield: Kafka Peak Shaving Answer-first: Shopee eliminates flash-sale inventory overselling and hot-key contention by combining client purchase tokens, local memory short-circuiting, and Redis Lua atomic stock deduction with sub-key sharding. Splitting high-demand SKU inventory across randomized sub-keys prevents single Redis master saturation, guaranteeing sub-two-millisecond reservation latencies and mathematically verified zero overselling across millions of concurrent checkout requests. ...