E-commerce needs accurate inventory:
Challenges:
- Overselling: Selling item that is out of stock
- Underselling: Showing out of stock when available
- Multi-channel: Same inventory across web, mobile, stores
Strategies:
- Optimistic: Allow checkout, verify at fulfillment
- Pessimistic: Reserve stock at cart add
- Hybrid: Soft reserve at cart, hard reserve at checkout
Architecture: Inventory service as source of truth. Replicate to search for reads. Writes go through inventory service.
Flash sales: Pre-allocate inventory. Queue requests. First N get confirmed.