Shopping Cart Systems (AP)
You'll learn: Why online shopping carts prioritize availability over strict consistency, allowing users to keep shopping even when data is temporarily out of sync.
The Problem: Checkouts Can't Wait
When you're browsing Amazon or any e-commerce site and adding items to your cart, you expect instant responses. If the system froze every time it needed to verify inventory across all data centers, the shopping experience would be frustratingly slow—and users would abandon their carts.
Why Shopping Carts Are AP Systems
E-commerce platforms choose availability over strict consistency during the shopping flow. When you add an item to your cart, the system immediately confirms it—even if that update hasn't propagated to all servers yet. Here's why this trade-off makes sense:
- User experience matters more than perfection — Shoppers won't tolerate slow responses while browsing
- Cart updates are low-stakes — If two data centers briefly disagree about your cart contents, no money has changed hands yet
- Final validation happens at checkout — The system can reconcile inventory and conflicts when you actually try to pay
Tolerating Temporary Inconsistency
Imagine two users adding the last TV to their carts simultaneously in different regions. Both operations succeed instantly (availability). The inconsistency—two people "holding" one item—is resolved later at checkout, where one user learns the item is sold out.
This is acceptable because:
- Cart operations are tentative, not committed transactions
- The checkout step acts as the consistency checkpoint
- Better to let everyone browse freely than block cart updates
Key Takeaway: Shopping cart systems embrace AP characteristics because keeping the shopping experience fast and responsive is more valuable than perfect real-time consistency across all carts—conflicts are resolved at the final checkout stage where accuracy truly matters.