Learn
Lesson · Availability and Failure · Fleets

Blast Radius and Shuffle Sharding

Give each tenant k of your n nodes, drawn at random. Two tenants share no node at all with probability C(n−k, k)/C(n, k) and hold the identical set with probability 1/C(n, k) — and only the identical set means one tenant's bad request can take the other down. At n = 16 and k = 2 those are 91/120 and 1/120, and one failed node degrades 1/8 of tenants while taking down none of them.

C(n, k) distinct shards n = 16, k = 2 → 120 P(share no node) = C(n−k, k)/C(n, k) = 91/120 = 75.833% P(identical set) = 1/C(n, k) = 1/120 = 0.8333% one bad node degrades k/n = 1/8 of tenants and takes down none
Two binomial coefficients, and the difference between them

Core ideas

What this lesson establishes

The whole lesson is a hypergeometric distribution over how many nodes two tenants have in common, and the two ends of it are the ones that matter.

1

Overlap has a distribution, and you can count it

A tenant holds k of n nodes. A second tenant, drawn independently and uniformly, shares exactly j of them with probability C(k,j)·C(n−k, k−j)/C(n,k). Summing over j gives one, which is the cheapest check on the arithmetic. At n = 16, k = 2 the three outcomes are 91/120, 7/30 and 1/120 for zero, one and two shared nodes.

2

Only the identical set is an outage for both

A tenant that shares one of your two nodes has lost half its capacity and still has the other half; it is degraded, not down. A tenant holding exactly your set has nowhere to go. So the number that matters is 1/C(n,k) = 1/120, not the 23.3% chance of some overlap — and those two differ by a factor of twenty-eight at this setting.

3

Blast radius is k/n, and it is degradation

A single bad node is used by the k/n of tenants whose shard includes it — 1/8 at n = 16, k = 2. Every one of them loses one node out of k and keeps the rest. Without shuffle sharding, a fleet split into n/k fixed shards would give the same node k/n of the tenants as a full outage, which is the same fraction with an entirely different consequence.

The material

Counting shards, overlaps and what each one costs

Where the two probabilities come from, why overlap is not collision, and how the numbers move when the shard size does.

Definition · Shuffle sharding

Under 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 tenant

The 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 assignment

The 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.

Interactive

Blast radius and shuffle sharding

Two tenants, k nodes each, and the probability that one of them takes the other down

Shuffle shardingC(n−k, k)/C(n, k) share nothing; only 1/C(n, k) share everything
the first tenantan identical setsome overlap

Method

Sizing a shuffle-sharded fleet

Two coefficients answer the question, and the third and fourth steps are where the answer either applies to your system or does not.

1

Compute C(n,k), and read it as the number of distinct shards

That integer is the headline: C(16,2) = 120, C(24,4) = 10 626. The probability that two tenants hold the identical set is its reciprocal, so the whole design is an argument about how large you can make a binomial coefficient at acceptable cost.

2

Separate the two probabilities, and check the terms sum to one

C(n−k,k)/C(n,k) for sharing nothing, 1/C(n,k) for sharing everything, and the hypergeometric terms in between. Summing all k + 1 of them must give exactly one; if it does not, a coefficient is wrong.

3

Decide what a partial overlap actually costs you

The arithmetic says a tenant sharing j < k nodes keeps k − j of them. Whether that is a working service depends on whether your client retries on another node and whether one node can carry the tenant's load. If either answer is no, partial overlap is an outage and the 1/C(n,k) figure is not the one to quote.

4

Trade k against the blast radius deliberately

Raising k shrinks 1/C(n,k) fast and raises k/n, so more tenants feel each failure at lower severity. Pick the point on that trade rather than inheriting it, and state both numbers when you do — a collision probability quoted without the blast radius has reported one half of the design.

Overlaps and blast radius

Score 0 / 0

Thirty-two nodes, four per tenant, a thousand tenants

A realistic sizing question. One tenant is capable of making a node unusable, and the operator wants to know how many other tenants go down with it and how many merely notice.

n = 32, k = 4, 1000 tenants C(32,4) = 35 960 distinct shards P(share no node) = C(28,4)/C(32,4) = 20 475/35 960 = 56.94% P(identical set) = 1/35 960 = 0.00278% the poisoned tenant takes down another tenant only if that tenant holds its exact four nodes expected fully-down tenants = 999 × 1/35 960 = 0.0278 and the degradation each of the 4 nodes is used by k/n = 1/8 of tenants tenants touching at least one of the 4 = 1 − 20 475/35 960 = 43.06% expected degraded tenants = 999 × 0.4306 ≈ 430 so: about 430 tenants notice, and 0.03 tenants are down

Both numbers are needed and they say opposite-sounding things. Nearly half the fleet is touched, which sounds alarming until the severity is attached: each of those tenants has lost one node of four and keeps three. The number of tenants that lose everything is 0.0278 in expectation — about one occurrence in thirty-six such events.

Compare the fixed-shard alternative at the same k: eight shards of four, each holding 125 tenants. The poisoned tenant takes its entire shard down, so 125 tenants are fully out and 875 are untouched. Shuffle sharding converts one hundred and twenty-five outages into four hundred and thirty degradations and a rounding error, which is the trade in one sentence.

For a faded rehearsal, the operator proposes n = 32, k = 2 instead, to halve the per-tenant footprint. The supplied first move is that C(32,2) = 496, so the collision probability rises by a factor of 35 960/496. Compute the expected fully-down tenants and the expected degraded tenants under that setting, check both in the lab, and say which of the two columns you would be willing to trade.

Common mistakes

1
Treating any overlap as a shared outageAt n = 16, k = 2, 23.3% of tenants share exactly one node with you and 0.8333% share both. Quoting the first figure as the risk overstates it by a factor of twenty-eight, and it also hides the design's entire point, which is that partial overlap leaves a working remainder. The number to quote is 1/C(n,k), with the degradation figure beside it.
2
Quoting a collision probability without the blast radius1/C(n,k) falls as k rises and k/n rises with it. A design justified only by the first number has chosen to make each individual node failure felt by more tenants without saying so. Both figures are properties of the same choice and belong in the same sentence.
3
Assuming the client can use the surviving nodesEvery probability here counts nodes, not service. If a tenant's requests are pinned to one node of its k, or if one node cannot carry the tenant's load alone, then losing j of k is an outage rather than a degradation and the arithmetic on this page is describing a system you do not have. Shuffle sharding is a placement scheme plus a client that retries.

Check your understanding

✓
Finish when you would answer “how bad is one bad node” with two numbers rather than one.

You should be able to compute C(n,k), the disjoint and identical probabilities and the hypergeometric terms between them, check that they sum to one, separate degradation from outage, and state the collision probability and the blast radius together as the two halves of one design choice.

Note: That closes the course. Availability is a fraction; chains multiply it down and redundant paths multiply it up, but only under an independence assumption that “Correlated Failure” exists to break; retries multiply load at the worst possible moment; and durability and blast radius are the two questions that are about a fleet rather than a request. The next course takes the replicas this one merely counted and asks whether they agree with one another, which turns out to be a different kind of arithmetic entirely.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.