We replaced Redis with MySQL for inventory reservations—and it scaled (2026) - Shopify

This post details the migration of Shopify's inventory reservation system from Redis to MySQL. Key technical contributions include: implementing a one-row-per-unit design with a bounded pool (capped at 1,000) for inventory reservations; utilizing MySQL 8's `SKIP LOCKED` feature for scalable contention management; adopting a composite primary key (`shop_id, inventory_item_id, inventory_group_id, id`) to reduce row locks; changing the transaction isolation level to `READ COMMITTED` to avoid gap locks and deadlocks; standardizing lock acquisition order across reserve and claim operations; and batching reservation queries using `UNION ALL`. The post also describes the discovery and resolution of a connection exhaustion bottleneck by implementing per-caller connection usage tracking and optimizing the checkout path, alongside re-evaluating MySQL's InnoDB thread concurrency.
More from the Data Store Selection and Usage trail
- Mitigating Deadlocks in high concurrency environments - Shopify
- Safely Adding NOT NULL Columns to Your Database Tables - Shopify
- Double Entry Transition Tables: How We Track State Changes At Shopify - Shopify
- Shopify’s Unique Data Science Hierarchy Of Needs - Shopify
- Upgrading MySQL at Shopify - Shopify