← InfraDraft

Fintech & Commerce

Design a Flash Sale System (High concurrency, preventing overselling)

A short-burst, extreme-concurrency purchase system that prevents overselling limited inventory under massive simultaneous demand.

Open and Simulate this Architecture in InfraDraft

Core Architectural Components

Pre-Sale Queueing/Waiting Room Service

Smooths a traffic spike into a manageable admission rate.

Atomic Inventory Decrement Service

Redis Lua script or row-level DB locking guaranteeing no two buyers claim the same unit.

Rate Limiter

Caps purchase attempts per user to blunt bot-driven demand.

Order Reservation with TTL

Holds a unit for a short window while payment completes, then releases it.

Distributed Lock Service

Coordinates the oversell-prevention check across concurrent requests.

Payment Timeout & Inventory Release Worker

Frees held inventory if checkout doesn't complete in time.

Traffic Shedding/Load Shielding Layer

Protects the backend from being overwhelmed at the moment the sale opens.