Skip to content
System Design Explorer
Company architectureintermediate

Shopify System Design

Every shop on one modular monolith, isolated into pods

By Ankur NayakReviewed

How Shopify serves its merchants through Black Friday peaks of 284 million requests a minute: a Rails modular monolith with enforced component boundaries runs on shared app servers, while shops are split into pods, each with its own isolated datastores, so one failure stays in one pod. Sorting Hat routes each request to its pod and Pod Mover can move a pod between data centres in a minute.

Open in Studio· edit a copy
Throughput
284M req/min at the edge (BFCM 2024)
Storage
57.3 PB of data (BFCM 2024)
App server peak
80M req/min
Database queries
10.5 trillion
Checkouts tested
80,000+/min
Monolith
2.8M+ lines of Ruby
Shopify system design architecture diagramComponents: Shopper / Merchant, Edge, Sorting Hat, App Servers (Rails monolith), Job Workers, Pods, Kafka, Genghis Load Tests. Connections: Shopper / Merchant to Edge (storefront / checkout); Edge to Sorting Hat; Sorting Hat to App Servers (+ pod header); App Servers to Pods (one pod per request); App Servers to Job Workers (enqueue jobs); Job Workers to Pods (one pod per job); Pods to Kafka (ETL); Genghis Load Tests to Edge (synthetic BFCM load).Shopper / MerchantClientEdgeCDNSorting HatLoad balancerApp ServersRails monolithJob WorkersWorkerPodsSQL databaseKafkaStreamGenghis Load TestsMonitoring

Requirements

Functional

  • Host storefronts, carts and checkout for a huge number of independent shops
  • Give merchants an admin to manage products, orders and inventory
  • Run background jobs such as emails, webhooks and fulfilment
  • Move shops between data centres without downtime

Non-functional

  • Survive flash sales and Black Friday peaks of hundreds of millions of requests a minute
  • Contain failures: one database problem must not take down every shop
  • Keep a very large codebase productive for over a thousand developers
  • Recover quickly from a data-centre failure

In depth

Commerce for many independent shops

Shopify hosts storefronts, carts and checkout for a huge number of independent merchants, all on one platform. Its traffic is spiky in a way few systems are: a product drop or a Black Friday sale can multiply load in seconds. During Black Friday Cyber Monday (BFCM) 2024, Shopify peaked at 284 million requests per minute at the edge and 80 million at its app servers, and ran 10.5 trillion database queries over the weekend.

Shopify's engineering blog explains the architecture behind that in a few key posts: pods (2018), the modular monolith (2019 and 2020), and how it prepares for BFCM (2025).

From one database to pods

Shopify's history is a familiar one. For years the answer to growth was a bigger database server, until, in 2015, there was no bigger server to buy. Shopify sharded its data, but sharding alone left a problem: shards still shared other parts of the system, so a failure in one could spiral into a platform-wide outage.

In 2016 Shopify reorganised its runtime architecture around pods. A pod is a set of shops that live on a fully isolated set of datastores. Everything stateful a shop needs is inside its pod. What stays shared are the stateless resources: app servers, job workers and load balancers. The rule is that a shared resource only talks to one pod at a time for any given request or job. See cell-based architecture.

The payoff is blast-radius control. If a pod's database has a problem, the shops in that pod are affected, and every other shop keeps selling.

Routing: Sorting Hat

Every request has to reach the right pod. Shopify built Sorting Hat, software in its load balancers that matches each incoming request to a pod using a list of rules, and adds a header saying which one. The app servers read that header and connect to that pod's datastores. Because routing is decided at the load balancer, app servers stay stateless and interchangeable.

Moving pods: Pod Mover

Each pod is assigned a pair of data centres: one active and one acting as a recovery site. A tool called Pod Mover can move a pod to its recovery data centre in about a minute, without dropping requests or jobs. Because pods are independent, they can be evacuated or rebalanced one at a time, which makes data-centre maintenance and failure recovery routine operations rather than emergencies.

Shopify's post describes pods as isolated sets of datastores without listing which ones, so the diagram doesn't name specific databases.

One codebase, many components

On the code side, Shopify chose a modular monolith over microservices. Its core is a single Rails application: in 2020 it had over 2.8 million lines of Ruby and 500,000 commits, worked on for over a decade by more than a thousand developers.

A big monolith tends to become a tangle: any code can call any other. Shopify's 2019 post describes the componentization effort that began in early 2017: dividing the codebase into components for domains such as orders, shipping, inventory and billing, each with a clean, dedicated interface and strictly enforced boundaries. By 2020 there were 37 components. A tool called Packwerk analyses static constant references to find code that reaches across a boundary, replacing an earlier call-tracing tool, Wedge.

The approach keeps all of the code in one codebase while gaining much of what teams want from service boundaries: clear ownership, interfaces between domains, and the ability to run only the tests for the components a change affects. A common argument for this over microservices is that it avoids network calls and distributed transactions between domains that often change together.

Preparing for Black Friday

Shopify treats BFCM as a project that runs for months. Its 2025 post describes five major scale tests between April and October, using Genghis, its load generator, which runs scripted shopper journeys (browsing, adding to cart, checking out) against production from three Google Cloud regions. The goal was 150% of the previous year's peak; by the fourth test they reached 146 million requests per minute and over 80,000 checkouts per minute.

Alongside load tests, teams run game days on critical journeys such as checkout, payments and fulfilment, inject faults with Toxiproxy, and track their readiness in a resiliency matrix. Some fixes are mundane but essential, such as adding Kafka partitions for ETL pipelines that would otherwise fall behind.

Failures

The design assumes failures happen and limits their reach. A database failure is contained to one pod. A data-centre problem is handled by moving pods to their recovery sites one at a time. A traffic surge beyond plans is the scenario BFCM preparation is designed to rehearse, so bottlenecks show up in testing rather than on the day.

The trade-offs

Pods trade cross-shop simplicity for isolation: anything that spans shops now spans pods, and routing has to know every shop's location. Sharing app servers keeps capacity flexible but leaves the stateless tier as a shared dependency. The modular monolith avoids microservice overhead at the cost of investing in tooling to keep boundaries honest. And rehearsing in production finds real bottlenecks but requires care to keep synthetic traffic away from real orders.

Compare the isolation approach with Stripe, which shards a document database and protects its API with rate limiters, and see the rate limiter design.

What to take into an interview

  • Isolate tenants' data into cells (pods); share only stateless compute
  • Route each request to its cell at the load balancer
  • Give each cell a recovery site and a tool to move it quickly
  • A modular monolith with enforced boundaries can scale a large team without microservices
  • Load-test production well beyond last year's peak, months in advance

Components

Shopper / Merchant

Client. Browses a storefront, checks out, or manages a shop in the admin.

Edge

CDN. The front door for all traffic; during BFCM 2024 it peaked at 284 million requests per minute, far more than reached the app servers.

Sorting Hat

Load balancer. Software in Shopify's load balancers that matches each request to the pod holding its shop, using a list of rules, and adds a header telling the app servers which pod to use.

Building block: Load Balancer

App Servers

Rails monolith

Service. Shared app servers running Shopify's core Rails monolith. Each request talks to exactly one pod, chosen from Sorting Hat's header.

Why: Sharing stateless compute across all pods keeps capacity flexible; isolation lives in the data layer.

Shipping Component

Service. One domain with a clean, dedicated interface.

Orders Component

Service. Orders, shipping, inventory and billing are examples of the domains given their own components.

Inventory Component

Service. Another component; it may only be reached through the owning component's public interface.

Packwerk

Monitoring. A tool that statically analyses constant references to find code crossing component boundaries; in 2020 it ran on about a third of the 37 components.

Job Workers

Worker. Shared background workers. Like app servers, each job talks to one pod at a time.

Pods

SQL database. A pod is a set of shops living on a fully isolated set of datastores. Pods were introduced in 2016 so a failure in one shard couldn't spiral into a platform outage.

Why: In 2015 Shopify could no longer buy a bigger database server; sharding followed, and pods made each shard a fully isolated unit.

Building block: Cell-Based Architecture, Database Sharding

Shops in the Pod

Service. A set of shops assigned to this pod.

Active Datastores

SQL database. The pod's isolated datastores in its active data centre. Shopify's post doesn't list which datastores.

Recovery Site

SQL database. The pod's second data centre, ready to take over.

Pod Mover

Scheduler. Moves a pod to its recovery data centre in about a minute without dropping requests or jobs.

Kafka

Stream. Streams data to ETL pipelines; preparing for BFCM 2025 included increasing Kafka partitions for them.

Building block: Message Queue & Event Log

Genghis Load Tests

Monitoring. Shopify's load generator: scripted browsing, cart adds and checkouts against production, run from three Google Cloud regions. In 2025 tests reached 146M requests per minute and 80,000+ checkouts per minute.

Request flows

Check out during a flash sale

  1. A shopper clicks Buy in the first minute of a limited product drop.
  2. The request passes the edge to Shopify's load balancers.
  3. Sorting Hat matches the request to the shop's pod and adds a header.
  4. An app server runs checkout against that pod's isolated datastores only.
  5. Follow-up work such as confirmation emails is queued for job workers.
  6. The order is confirmed; other shops in other pods never felt the spike.

Rehearse Black Friday

  1. Months before BFCM, Genghis runs scripted shopper journeys from three regions, aiming at 150% of last year's load.
  2. Traffic flows through the real routing and app tier.
  3. Bottlenecks in pods and pipelines are found and fixed before the real peak.

Failure scenarios

What if: a pod's database fails?

Only the shops in that pod are affected: other pods have their own datastores, and app servers serve their requests normally. This was the point of pods: a failure can't spiral into a platform outage.

User impact: Shops in one pod have trouble; every other shop is unaffected.

  • Fully isolated datastores per pod
  • Pod Mover to the recovery site

What if: black Friday traffic exceeds plans?

BFCM 2024 peaked at 80 million requests per minute at the app servers. Shopify prepares with five major scale tests, game days on critical journeys such as checkout and payments, and fault injection with Toxiproxy, so limits are found in rehearsal rather than on the day.

User impact: Slow storefronts and failed checkouts if capacity runs out.

  • Load tests at 150% of last year's peak
  • Game days
  • Fault injection

Trade-offs

Pods: isolate data, share compute

Give each group of shops its own datastores while sharing app servers, workers and load balancers.

Pros
  • A data failure is contained to one pod
  • Pods can move independently between data centres
Cons
  • Cross-shop queries span pods
  • Routing must know every shop's pod

A modular monolith instead of microservices

Keep one Rails codebase but enforce boundaries between components.

Pros
  • No network hops or distributed transactions between domains
  • Tests can target the affected components
Cons
  • Boundaries need tooling (Wedge, then Packwerk) to stay enforced

Routing at the load balancer

Decide each request's pod in Sorting Hat and pass it as a header.

Pros
  • App servers stay stateless and pod-agnostic
  • Pods can be moved by changing rules
Cons
  • Sorting Hat is on every request's critical path

Rehearse peaks in production

Load-test production with synthetic shopper journeys months ahead of BFCM.

Pros
  • Finds real bottlenecks before the real peak
Cons
  • Synthetic load must be carefully isolated from real orders

Frequently asked questions

What is a pod at Shopify?

A pod is a set of shops that live on a fully isolated set of datastores. App servers, job workers and load balancers are shared, but each request talks to one pod, so a database failure affects only the shops in that pod. Shopify introduced pods in 2016.

How does Shopify route requests to the right pod?

Software in its load balancers called Sorting Hat matches each request to a pod using a list of rules and adds a header. The app servers read the header and connect to that pod's datastores.

Does Shopify use microservices?

Its core is a modular monolith: one Rails codebase (over 2.8 million lines of Ruby in 2020) divided into components with strictly enforced boundaries, such as orders, shipping, inventory and billing. A tool called Packwerk checks that code doesn't reach across component boundaries.

How much traffic does Shopify handle on Black Friday?

During Black Friday Cyber Monday 2024, Shopify peaked at 284 million requests per minute at the edge and 80 million at its app servers, and ran 10.5 trillion database queries over the weekend.

Building blocks used

Sources