Definition · Shuffle shardingUnder shuffle sharding each tenant is assigned a random k-subset of the n nodes, drawn independently per tenant, rather than being placed in one of n/k fixed shards. There are C(n,k) distinct assignments. Two tenants overlap in j nodes with probability C(k,j)·C(n−k, k−j)/C(n,k); they are disjoint when j = 0 and identical when j = k.
The counting is direct. Fix the first tenant's k nodes. The second tenant's set is one of the C(n,k) equally likely subsets, and the ones sharing exactly j nodes are formed by choosing j from the first tenant's k and the remaining k − j from the n − k nodes it does not hold. That is the hypergeometric distribution, and nothing about it is approximate.
n = 16, k = 2. C(16,2) = 120 distinct shards
j ways probability meaning
0 C(2,0)·C(14,2) = 91 91/120 75.8333% untouched
1 C(2,1)·C(14,1) = 28 7/30 23.3333% degraded, 1 of 2 left
2 C(2,2)·C(14,0) = 1 1/120 0.8333% down with you
─── ────────
120 100%
Read the third row against the second. Nearly a quarter of tenants share a node with you, and one in a hundred and twenty shares both. Sharing nothing is 91 times likelier than sharing everything, and that ratio is the entire argument for drawing shards at random rather than assigning them in blocks.
Why overlap is not collision
Suppose a tenant sends a request that makes a node unusable — a poison pill, a query that exhausts memory, a pattern that triggers a bug. Every tenant sharing that node is affected. But a tenant that shares one of your two nodes still has one working node and, if the client retries elsewhere, still has a service. Only a tenant whose entire set is inside the damage has nothing left.
Example · One bad node, sixteen nodes, two per tenantThe node fails or is poisoned. k/n = 1/8 of tenants use it, so one in eight is degraded to a single remaining node. None is down, because no tenant's shard is a subset of a single-node failure when k = 2. Compare a fixed-shard layout of eight shards of two: the same node takes out one shard entirely, and every tenant in it — 1/8 of the fleet — is fully down.
What raising k does
Raising k cuts the collision probability hard, because C(n,k) grows quickly, while raising the blast radius k/n of each individual node. At n = 24 and k = 4 there are 10 626 distinct shards, so two tenants collide with probability 1/10 626 — 0.0094% — and 45.596% share nothing. The cost is that one bad node now touches 1/6 of tenants rather than 1/8, each of them losing one node of four.
n = 24, k = 4. C(24,4) = 10 626 distinct shards
P(share no node) = C(20,4)/C(24,4) = 4845/10 626 = 45.596%
P(identical set) = 1/10 626 = 0.0094%
one bad node degrades k/n = 1/6 of tenants
against n = 16, k = 2: 1/120 = 0.8333%, blast 1/8
Two levers and they pull in opposite directions, which is the design question this lesson leaves you with. More nodes per tenant means fewer tenants can take you down with them and more tenants feel each individual failure, at a lower severity each. The lab computes both columns for whatever n and k you set.
Example · Reading the drawn assignmentThe lab draws a sample assignment from a seed and marks each tenant with the number of your nodes it shares. At n = 16, k = 2 and twelve tenants, the expected number holding your exact set is 11/120 ≈ 0.0917, so a draw in which none does is the ordinary outcome. Raise the tenant count and the seed and watch how rarely a red row appears — that rarity is the 1/120, made visible.
One boundary. At k = 1 the distinction this lesson turns on disappears: a tenant on one node is degraded and down by the same event, and the collision probability is 1/n, which is simply the chance of landing on the same node. Shuffle sharding needs k ≥ 2 to mean anything, and the client has to be able to use the surviving nodes — if a request is pinned to one node of the k, the arithmetic on this page is describing a system you do not have.