Search DistillSys

Find a concept

Type at least two characters to search lessons, designs, papers, and interview prep.

Partitioning incident · Intermediate

One celebrity account overwhelms a shard

A technically balanced keyspace collapses when one key becomes globally hot.

01
Establish the operating contract

Incident brief

Business impact

A social feed normally serves 1.2M reads per second. One livestream drives 180k requests per second to a single creator.

Current architecture

Posts and counters are partitioned by creator ID using consistent hashing. Each partition has one write leader and two read replicas.

Protected invariant

Published posts must remain ordered for the creator; view counts may be approximate for up to five minutes.

Constraints
  • Per-creator post order is externally visible.
  • Clients cannot be updated during the event.
  • Approximate counters are acceptable; missing posts are not.
02
Build a causal model

Evidence timeline

  1. Fleet CPU remains 42%, but shard 317 reaches 100% CPU and 40× normal queue depth.

  2. Adding nodes moves ordinary ranges but creator 8842 remains on one partition.

  3. Replica reads help posts, while counter writes still saturate the leader.

  4. Cache hit rate drops as clients request many slightly different feed windows.

03
Reason before revealing

Your response

1Diagnose

Why did rebalancing fail despite spare fleet capacity?

Need a nudge?

A hash function spreads many keys; it cannot divide one indivisible key.

2Stabilize

How do you split reads and writes according to their semantics?

Need a nudge?

The post log and engagement counters do not require the same consistency.

3Recover

How do you migrate the hot key without breaking order?

Need a nudge?

Use explicit routing state, epochs, and a cutover watermark.

4Prevent

What hot-key mechanism should exist before the next event?

Need a nudge?

Detection and a reversible exception path matter more than perfect prediction.

04
Compare reasoning, not wording

Model response

Reveal structured response
Diagnosis

The distribution is balanced by key count but not by load. One creator key is indivisible under the current scheme, so ordinary ring rebalancing cannot spread its work.

Stabilize now
  1. Cache canonical post pages and coalesce identical misses.
  2. Fan read traffic across replicas while preserving a clear freshness contract.
  3. Buffer and aggregate commutative counter updates, shedding only nonessential precision.
  4. Apply per-tenant admission limits so one creator cannot consume recovery capacity.
Recover safely
  1. Introduce a routing exception for the hot creator rather than reshuffling the entire ring.
  2. Keep ordered posts on one sequencer or partition substreams with an explicit merge sequence.
  3. Cut over using an ownership epoch and watermark; reject writers using stale routing.
  4. Drain aggregated counter deltas idempotently after the event.
Prevent recurrence
  1. Detect load by key, not only by node or partition.
  2. Support hot-key replication, request coalescing, and exception routing as tested control-plane operations.
  3. Separate workloads by invariant: ordered posts, cacheable reads, and commutative counters.
  4. Capacity-plan for concentration and enforce tenant fairness.
05
Use evidence-based self-assessment

10-point rubric

Your score0 / 10

Check only the signals your answer demonstrated.

Common traps
  • Adding nodes and expecting the hot key to split
  • Randomly salting all creator data
  • Serving unlimited stale cache without a contract
  • Migrating ownership without fencing old writers
06
Strengthen the underlying concepts

Related refreshers