ShopifyXavier DenisExplainer
A Pods Architecture To Allow Shopify To Scale
Summary
Shopify outgrew its ability to scale by buying larger database servers, so it introduced database sharding in 2015. Sharding improved performance and horizontal scalability but made actions dependent on every shard, increasing the risk of platform-wide unavailability. In 2016, Shopify reorganized its runtime around pods: each pod groups shops on isolated datastores, while shared workers, application servers, and load balancers are restricted to one pod at a time. Sorting Hat assigns each request to a pod and location, while every web request and delayed job is kept within one pod; paired data centers and Pod Mover support recovery without dropping requests or jobs. The design makes a pod the unit for scalability, resiliency, and disaster recovery, and simplifies evacuating an entire data center.
Context
Shopify first used database sharding to continue scaling after larger database servers were no longer sufficient. The resulting dependency on all shards exposed a resilience problem: a single shard failure could make an action unavailable across the platform.
Approach / What changed
Shopify introduced pods, grouping shops onto fully isolated datastores while limiting shared resources to one pod at a time. Sorting Hat routes requests to the responsible pod and data-center location, and every web request or delayed job is assigned to a single pod. Each pod has a pair of data centers, with Pod Mover transferring it to the recovery site without dropping requests or jobs.
Takeaways
A pod contains shops on isolated datastores, while shared job workers, app servers, and load balancers can communicate with only one pod at a time.
Sorting Hat matches each request to a pod using rules, adds a header, and forwards it to the correct location so application servers query only one pod.
Pod Mover can move a pod to its recovery data center in a minute without dropping requests or jobs, making pods an operational unit for disaster recovery.
FAQ
How does Shopify route a request to the correct pod?
Sorting Hat in the load balancers applies a list of rules to match each request to a pod and adds that assignment in a header. The request is forwarded to the correct location, and application servers use the header to connect to the appropriate datastore.
Why are pods more resilient than database sharding alone?
With sharding alone, code could act across every shard, so one unavailable shard could make the entire action unavailable across the platform. Pods assign each web request and delayed job to one pod, meaning the work requires only that pod to be online.
How does Shopify handle a pod’s data-center failure?
Each pod is assigned a pair of data centers, with one active and the other serving as a recovery site. Pod Mover transfers a pod to its recovery data center in a minute without dropping requests or jobs.
Source and freshness
- Source
- shopify.engineering
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.