| Shopify replaced Redis with MySQL for inventory reservations–and it scaled(shopify.engineering) | |
| 330 points by adletbalzhanov 13 days ago | 246 comments | |
tl;dr: Shopify migrated inventory reservations from Redis to MySQL by using MySQL 8's SKIP LOCKED feature with one row per sellable unit (capped at 1,000 per item/location), enabling ACID guarantees across reservations and the inventory ledger. Key optimizations included composite primary keys to reduce lock counts, READ COMMITTED isolation to avoid gap locks, and consistent lock ordering to prevent deadlocks. The real bottleneck turned out to be database connection exhaustion from unrelated checkout code holding connections too long—fixing that (plus revisiting InnoDB thread concurrency) removed the ceiling and let the system handle Black Friday 2025's record traffic. | |
HN Discussion:
| |