Interview Q&A / System Design

AdvancedQuick answer1 min readUpdated 3 Oct 2026

How do you add more shards to a running system without a long outage?

SHORT ANSWER

Avoid plain modulo hashing, which moves most keys when the shard count changes. Use consistent hashing or many small virtual shards mapped to servers, then move a few of them in the background while dual-checking routing.

Explain it simply

With key % N routing, going from 4 to 5 shards changes the destination of about 80% of keys, so almost all data must move. That is why naive modulo is a trap.

Better approaches:

  • Consistent hashing: adding a node takes over a slice from its neighbours; only about 1/N of keys move.
  • Many logical shards: create, say, 1,024 logical shards from day one and map them to a few physical servers in a lookup table. Adding a server means moving some logical shards, not rehashing keys.

Migration steps for a logical shard:

  1. Copy data to the new server in the background.
  2. Stream ongoing changes so the copy catches up.
  3. Briefly pause writes to that shard, finish the sync.
  4. Update the routing table to the new location.
  5. Remove the old copy after verification.

Throttle the copy to protect production traffic, and keep routing metadata highly available.

Example

Going from 4 to 5 servers with 1,024 logical shards.

text
Before: 256 logical shards per server
After : about 205 per server
Moved : 4 x (256 - 205) = 204 logical shards (about 20% of data)
Keys never change logical shard, only the lookup table changes

What to say in the interview

"Naive modulo remaps most keys, so I use consistent hashing or many logical shards with a routing table. I migrate shard by shard: bulk copy, catch up on changes, short write pause, flip the routing, verify, delete. That keeps the outage to seconds, not hours."

#sharding#scaling

Related questions

Practise more System Design questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open System Design quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.