System Design Masterclass
E-Commerceflash-salehigh-throughputinventoryqueuingredisadvanced

Design Flash Sale Backend

Design backend for flash sales handling 6M orders in 1 hour

6M+ orders/hour, 100K+ RPS|Similar to Amazon, Alibaba, Flipkart, Shopify, Walmart|45 min read

Summary

Flash sales create extreme traffic spikes where millions of users compete for limited inventory in seconds. The core challenge is handling 100x normal traffic while maintaining inventory accuracy and preventing overselling. This is asked at Amazon, Alibaba, Flipkart, and any e-commerce company running promotional events.

Key Takeaways

Core Problem

This is fundamentally a distributed inventory reservation problem under extreme concurrency. We must prevent overselling while handling 100x normal traffic.

The Hard Part

Maintaining inventory accuracy when thousands of concurrent requests try to purchase the same limited item. Race conditions can cause overselling or underselling.

Scaling Axis

Scale by product ID for inventory operations. Use request queuing to convert spike traffic into steady stream.

The Question: Design a backend system that can handle a flash sale with 6 million orders in 1 hour, where limited inventory items are sold at deep discounts.

Flash sales are challenging because: - Traffic spikes: 100x normal traffic in first few seconds - Limited inventory: 10,000 items, 1 million buyers - Time pressure: Sale starts at exact time, everyone refreshes simultaneously - Fairness concerns: First-come-first-served must be honored - Money involved: Overselling means refunds, angry customers, legal issues

What to say first

Before I design, let me clarify the scale and constraints. I want to understand inventory quantities, expected traffic patterns, and what guarantees we need around fairness and inventory accuracy.

Hidden requirements interviewers test: - Can you handle extreme traffic spikes gracefully? - Do you understand inventory consistency challenges? - Can you design for failure during peak load? - Do you know techniques like queuing, caching, and rate limiting?

Premium Content

Sign in to access this content or upgrade for full access.