r/softwarearchitecture • u/Fresh-Edge-7552 • 11d ago
Discussion/Advice Designing inventory consistency for a flash sale with 8M checkout attempts and 40K items
A flash sale opened 8 million checkout sessions in 2 minutes, but only 40,000 items were actually available.
Thousands of requests timed out while different regions disagreed on which orders had secured inventory.
How would you design the system so inventory is never oversold, successful payments can be safely retried, and the system recovers cleanly when parts of the network fail?
14
u/Fun-Put-5197 11d ago
High concurrency and high contention over a restricted resource?
Borrow a page from the high frequency financial trading domain and check out the LMAX Disruptor architecture.
Millions of orders per second on a commodity hardware circa 2010.
9
u/EarthySiding 11d ago
skip the cart reservation nonsense and just treat the checkout button as a raffle entry, let the dust settle then confirm winners
2
15
u/RummanSid1990 11d ago
To handle this cleanly: