---
title: "We replaced Redis with MySQL for inventory reservations—and it scaled"
description: "Shopify replaced its Redis-based inventory reservation system with MySQL to unify reservations with the inventory ledger and provide ACID coordination between payment and inventory updates. The new design stores one row per sellable unit in a bounded pool of up to 1,000 rows per item/location combination, uses MySQL 8's SKIP LOCKED to avoid waiting on locked units, and replenishes depleted pools. Composite primary keys reduced row locks, READ COMMITTED avoided gap locks that interfered with replenishment, and consistent lock ordering prevented deadlocks. The investigation found connection-pool usage elsewhere in checkout, rather than reservation query speed alone, was the immediate ceiling; cleanup removed 50% of primary-database reads and 33% of transactions, while configuration changes added headroom. Shopify validated the design in shadow mode, then rolled it out gradually with a Redis rollback path, meeting high-throughput targets during peak 2025 traffic."
---

# We replaced Redis with MySQL for inventory reservations—and it scaled

[Shopify](https://yomu.fyi/company/shopify) · 2023-10-18 · May 12, 2026

**Type:** Problem & solution

## Summary

Shopify replaced its Redis-based inventory reservation system with MySQL to unify reservations with the inventory ledger and provide ACID coordination between payment and inventory updates. The new design stores one row per sellable unit in a bounded pool of up to 1,000 rows per item/location combination, uses MySQL 8's SKIP LOCKED to avoid waiting on locked units, and replenishes depleted pools. Composite primary keys reduced row locks, READ COMMITTED avoided gap locks that interfered with replenishment, and consistent lock ordering prevented deadlocks. The investigation found connection-pool usage elsewhere in checkout, rather than reservation query speed alone, was the immediate ceiling; cleanup removed 50% of primary-database reads and 33% of transactions, while configuration changes added headroom. Shopify validated the design in shadow mode, then rolled it out gradually with a Redis rollback path, meeting high-throughput targets during peak 2025 traffic.

## Context

Shopify needed oversell protection that could handle peak checkout traffic, respect multi-location inventory, preserve ACID guarantees between reservations and the inventory ledger, and avoid both overselling and lost sales. The Redis implementation handled concurrency but split reservations from the MySQL ledger, creating failure modes during claim and adding the operational cost of a separate cluster.

## Approach / What changed

The replacement uses MySQL 8 with one row per sellable unit in a bounded pool capped at 1,000 rows per item/location combination. Reservations select rows with SKIP LOCKED, while replenishment refills the pool from the inventory ledger. Composite primary keys, READ COMMITTED transactions, consistent lock ordering, and other database changes addressed locking and deadlock issues. The system was tested in dual-write shadow mode before a gradual cutover with a Redis rollback path.

## Takeaways

- A bounded pool of up to 1,000 reservation rows per item/location combination keeps one-row-per-unit reservations from growing without limit while allowing replenishment to absorb bursts.
- Using filtered columns in a composite primary key reduced InnoDB locking from two row locks per reservation to one; READ COMMITTED also prevented gap-lock behavior that blocked replenishment.
- The limiting factor was connection usage elsewhere in checkout, not reservation speed alone. Cleanup removed 50% of primary-database reads and 33% of transactions, and thread-concurrency changes added capacity.

**Tags:** [MySQL](https://yomu.fyi/topic/mysql), [Performance](https://yomu.fyi/topic/performance), [Redis](https://yomu.fyi/topic/redis), [Reliability](https://yomu.fyi/topic/reliability), [Scalability](https://yomu.fyi/topic/scalability)

- Source: [Shopify](https://shopify.engineering/scaling-inventory-reservations)
- Source URL: https://shopify.engineering/scaling-inventory-reservations
- Ingested by Yomu: 2026-08-30T13:17:56.300Z

[Read original post](https://shopify.engineering/scaling-inventory-reservations)
