Skip to content

DNS / HTTP · 7 of 8

Step 1 · The pattern

One fleet, shared by everyone

Five customers share eight workers, and any worker can serve any customer. It is efficient: if one worker dies, the other seven absorb its work.

  • request
  • answered

In short

Shuffle sharding: how it works and how it breaks

When many customers share one fleet, a single customer can hurt everyone: a flood of traffic or a request that crashes its handler takes out one worker, the work moves to the next, and the failure walks through the fleet. Sharding limits the damage. Split eight workers into four shards of two and a bad customer can only break its own shard, a quarter of the service, but every customer on that shard goes down with it. Shuffle sharding gives each customer its own combination of workers instead. Eight workers make 28 different pairs, so two customers rarely get the same pair and usually share one worker at most. When a customer's pair fails, its neighbours retry on their other worker and carry on. Amazon Route 53 gives every domain four of 2,048 virtual name servers, about 730 billion possible combinations.

How this comes up in interviews

"Many customers share one fleet of workers. One customer's requests keep crashing whichever worker handles them. How do you protect the others?"

Then they ask

  1. Plain sharding already limits the damage. What does shuffle sharding add for a customer on the same shard?
  2. A neighbour shares one worker with the bad customer. What must its client do to stay online?
  3. What kinds of failure does shuffle sharding not help with at all?

A strong answer covers

  • On a fully shared fleet, one bad customer's traffic lands on every worker and the failure walks through the fleet.
  • Fixed shards confine the damage to one shard, but every customer on that shard goes down with it.
  • Shuffle sharding gives each customer its own combination of workers, so two customers rarely share the same set.
  • Eight workers make 28 pairs, so neighbours usually share one worker at most.
  • It relies on clients retrying on their other worker. It does not stop the bad traffic or repair anything.

Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.

On one page: the track cheat sheet.

Last updated: Official documentation

Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.