Shopify architecture: how Shopify scaled (6 case studies)
Most of the Shopify engineering write-ups we track are about MySQL. Shopify rebalances sharded MySQL by moving individual shops between shards online with its Ghostferry tool, routes reads to replicas with consistency guarantees such as monotonic reads, sharded the Shop app's Rails backend with Vitess, and in 2026 moved checkout inventory reservations from Redis to MySQL. Capacity for peaks like BFCM is planned with forecasts and scalability tests.
We track 6 public engineering write-ups by Shopify, published between 2020 and 2026. Techniques that come up more than once: database migration (2). Stack mentioned most: MySQL (4). 3 of the 6 state concrete scale numbers, for example "billions of product listings across millions of stores". Each card below links to our short summary and the original post.
Tech used in Shopify's scaling write-ups
Shopify scaling timeline: every story, summarized
- 2020-12-03
Capacity Planning at Scale
How Shopify plans and checks capacity for traffic peaks like BFCM using forecasts and scalability tests.
- 2021-02-22
Read Consistency with Database Replicas
Shopify routes reads to MySQL replicas while giving apps consistency guarantees such as monotonic reads.
- 2021-09-24
Shard Balancing: Moving Shops Confidently with Zero-Downtime at Terabyte-scale
Shopify rebalances MySQL shards by moving individual shops online with its Ghostferry tool.
- 2024-01-17
Horizontally scaling the Rails backend of Shop app with Vitess
Shopify's Shop app adopted Vitess to shard its Rails backend, covering keyspace design and the migration plan.
- 2026-05-12
We replaced Redis with MySQL for inventory reservations—and it scaled
Shopify moved checkout inventory reservations from Redis to MySQL using one row per sellable unit, a bounded pool of 1,000 rows per item/location and SELECT ... FOR UPDATE SKIP LOCKED. The real ceiling was connections held by other checkout code: tagging SQL by business process and measuring hold time in ProxySQL found it, and the cleanup removed 50% of reads and 33% of transactions on the primary.
- 2026-10-20
Cross-store product clustering across millions of stores
Shopify groups the same real-world product sold by different merchants under one Universal Product Identifier. Embedding nearest-neighbor search finds plausible pairs across billions of listings, then three scorers of rising cost judge them: a CPU GBDT (L1) over trillions of pairs, a fine-tuned multilingual E5 cross-encoder (L2), and an image-aware reranker (L3) fed from prioritized GPU queues. A bounded union-find splits the graph into single-machine components, and HAC with a learned GBDT merge rule builds high-precision clusters daily, with an LLM judge validated against human labels supplying training data and cached scores reused between builds.
FAQ
What database does Shopify use?
MySQL appears in 4 of the 5 Shopify write-ups we track: sharded MySQL with shops moved between shards by Ghostferry, MySQL read replicas with consistency guarantees, Vitess for the Shop app's Rails backend, and MySQL behind ProxySQL for checkout inventory reservations. Redis also appears, as the system inventory reservations moved away from.
How does Shopify handle Black Friday traffic?
Shopify's 2020 post Capacity Planning at Scale describes planning and checking capacity for traffic peaks like BFCM using forecasts and scalability tests. Its 2026 inventory reservations post cites a Black Friday 2025 peak of $5.1 million in sales per minute.
How did Shopify move inventory reservations from Redis to MySQL?
Per Shopify's 2026 post, it used one row per sellable unit, a bounded pool of 1,000 rows per item and location, and SELECT ... FOR UPDATE SKIP LOCKED. The real ceiling turned out to be connections held by other checkout code, which Shopify found by tagging SQL by business process and measuring hold time in ProxySQL.