We replaced Redis with MySQL for inventory reservations and it scaled
- Databases
- Infrastructure
- E-commerce
- AI
- Developer Tools
Shopify’s post describes a checkout problem that only shows up when many buyers race for the same physical inventory at once. Their old design kept the source-of-truth inventory in MySQL but tracked short-lived reservations in Redis, which made oversell protection a cross-system consistency problem. The new design pulls reservations back into MySQL. Instead of decrementing one hot quantity row per SKU, it uses `SELECT ... FOR UPDATE SKIP LOCKED` against a bounded buffer of reservable rows for each item and location. A replenishment process refills that buffer from the main inventory ledger so checkout can avoid hammering one contended counter. The claimed payoff was simpler correctness and lower load on the main database once they also reduced query count and connection pressure.
If you run reservations across multiple datastores, the operational and correctness costs can outweigh the raw speed win. But Shopify’s exact pattern is a scale-specific tradeoff, not a general recipe, so teams should validate their own contention profile before copying the bounded-row design.
-
shopify.engineering
- Discuss on HN