X-ShardId

Shopify distributes merchant data across isolated MySQL shards, and the X-ShardId unofficial response header identifies which database shard served a given request.

Usage

Shopify distributes merchant data across many MySQL database shards. Each shard is part of a pod, an isolated instance of the Shopify platform containing its own database, Redis, and Memcached datastores. The X-ShardId header exposes which shard handled the database operations for a given request.

The shard identifier is assigned when Shopify's load balancer routes the request to the correct pod using the Sorting Hat routing layer. Because each pod maps to a single MySQL shard, the X-ShardId value matches the X-Sorting-Hat-PodId value on every observed response. Shopify rebalances shards over time by migrating stores between pods using an internal tool called Ghostferry, so a store's shard assignment is not permanent.

Values

Numeric shard identifier

The value is a positive integer identifying a specific MySQL database shard. Each number maps to an isolated database instance serving a group of merchant stores. Requests for stores on the same shard return the same X-ShardId value.

-1

A value of -1 indicates the request was not associated with a specific database shard. This appears on requests to generic Shopify endpoints or unresolved store domains where no store-specific data lookup occurred.

Example

A request to a Shopify store returned shard 263. This means the store's database records are stored on MySQL shard 263.

X-ShardId: 263

A different store assigned to shard 43. Stores on separate shards have fully isolated database instances with no shared data between them.

X-ShardId: 43

A value of -1 means no shard was involved in processing the request.

X-ShardId: -1

The X-ShardId header typically appears alongside other Shopify infrastructure headers. The shard ID and pod ID share the same numeric value on every observed response, because each pod maps to one database shard.

X-ShardId: 337
X-Sorting-Hat-PodId: 337
X-ShopId: 12345678
X-Sorting-Hat-ShopId: 12345678

See also

Last updated: August 18, 2026