Shopify

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

May 12, 2026
We replaced Redis with MySQL for inventory reservations—and it scaled (2026) - Shopify
SummaryAI, from the source post

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