Catalogue / shopify-2021-mysql-shard-balancing

Shopify rebalances podded MySQL shards online by moving individual shops with Ghostferry and Redis MRSW locks

Shopify, 2021. Podded MySQL database shard balancing.

Organisation
Shopify
Evidence
Reported from production
Source
Shard Balancing: Moving Shops Confidently with Zero-Downtime at Terabyte-scale

Shopify Engineering, published 2021-09-24

Records

Decision#d1

Rebalance podded MySQL shards online by migrating individual shops with Ghostferry

Decision#d2

Plan shard rebalancing from historical utilization cohorts and pre-move simulations rather than shop counts

Decision#d3

Guard online shop migration with SELECT FOR UPDATE batch locking, Redis MRSW cutover locks, verifiers and TLA+

Sign in to read what was chosen, what was rejected and what it cost, each with its place in the source. An account is free.