Bird
0
0

In designing an e-commerce system to handle flash sales with thousands of users buying limited stock simultaneously, which approach best ensures system reliability and fairness?

hard📝 Trade-off Q15 of 15
LLD - Design — Online Shopping Cart
In designing an e-commerce system to handle flash sales with thousands of users buying limited stock simultaneously, which approach best ensures system reliability and fairness?
AImplement distributed locking and inventory reservation before payment
BAllow unlimited purchases and fix inventory later
CDisable user authentication during flash sales
DStore all orders in a single database table without indexing
Step-by-Step Solution
Solution:
  1. Step 1: Identify challenges in flash sales

    Flash sales cause high concurrency and limited stock, needing careful inventory control.
  2. Step 2: Evaluate approaches for reliability and fairness

    Distributed locking and reserving inventory before payment prevents overselling and ensures fairness.
  3. Step 3: Reject unsafe or inefficient options

    Allowing unlimited purchases or disabling authentication causes errors and security risks; poor database design hurts performance.
  4. Final Answer:

    Implement distributed locking and inventory reservation before payment -> Option A
  5. Quick Check:

    Concurrency + limited stock = locking + reservation [OK]
Quick Trick: Lock inventory before payment to avoid overselling [OK]
Common Mistakes:
  • Ignoring concurrency control
  • Disabling security features
  • Using inefficient database design

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes