Cluster Topology and Data Distribution

Part 1 established that Cassandra is leaderless. This part is the mechanism that makes leaderless actually work: a hash ring that decides where every row lives, a bootstrap protocol that moves data without a single second of unavailability, and a gossip layer that keeps every node's picture of the cluster current with no coordinator anywhere. The recurring theme is that nothing here is centrally orchestrated — every behavior emerges from each node independently recomputing the same answer from its own local view.

The Ring and Consistent Hashing

Cassandra distributes data across nodes using consistent hashing.

Imagine a circular ring of values from 0 to 264 − 1. Each node is assigned a position on that ring — a token. When a row is written, Cassandra hashes the partition key to produce a number in that same range. The row belongs to whichever node owns the token range covering that hash: specifically, the first node clockwise from the hash position.

A token ring normalised to 0 to 100 with four nodes: A at token 0, B at 25, C at 50 and D at 75. Each node owns the arc between its predecessor and itself: B owns 0 to 25, C owns 25 to 50, D owns 50 to 75 and A owns 75 to 100. To place a row, hash its partition key and walk clockwise to the first node. Hash 30 walks to token 50, so Node C owns it. Hash 80 walks past 100, wraps to token 0, and lands on Node A.
Hash the key, walk clockwise — the first node you hit owns the row

Why Adding a Node Doesn't Rehash Everything

In a traditional hash table — node = hash(key) % N — changing N changes the result for almost every key, so almost every key has to move. Consistent hashing avoids this because each node is responsible only for the arc between itself and its predecessor. A new node claims a slice of one existing node's range. Only the keys in that slice move; everything else stays exactly where it was.

hash(key) % NConsistent hashing
Adding the 5th node to a 4-node cluster~80% of keys map to a different nodeOne arc splits; roughly 1/5 of one node's keys move
What has to moveNearly the whole datasetOne slice of one node's data
Can it be done live?Effectively noYes — this is the whole point

This is what makes Cassandra horizontally scalable without downtime — and §2 is the protocol that turns "only one slice moves" into "and nothing is unavailable while it moves."

  • Guarantees: Every partition key deterministically maps to exactly one primary owner, computable locally by any node with a current ring view — no lookup service, no directory, no coordination.
  • Does not guarantee: Even ownership by itself. Tokens are positions on a ring; if they're placed badly, arcs are badly sized. That's what token allocation (§2) and vnodes (§4) exist to fix.

Adding a Node, Without Downtime

§1 showed which node owns a key. This section is about what happens the moment that answer changes — when a new node joins and takes over part of someone else's arc.

The whole trick is one word: the data is copied, not moved. The old owner never stops holding it, and never stops serving it, until the new owner is provably complete.

"Moving" would mean the data is somewhere in between — briefly owned by nobody. "Copying" means there are two full copies for a while, and the handover is just a decision about which one to ask. That's the entire reason a join needs no downtime.

The Example We'll Use Throughout

Two nodes, one range each. A third node joins and splits A's range in half:

A token range from 0 to 100. Before: Node A owns 0 to 50 and Node B owns 50 to 100. Node C joins and picks token 25, splitting A’s range: C now owns 0 to 25, A keeps 25 to 50, and B is unaffected. Only the contested range 0 to 25 moves, from A to C.
C joins at token 25 — only A’s lower half changes hands

Node B never enters the story. Everything below is about the contested range [0, 25) — the slice moving from A to C.

The Five Steps of a Join

  1. C picks its token — deliberately, not at random. Before joining, C asks the nodes it can already see: who currently owns the most data? It then picks a position that splits that node's range, so the biggest owner gets cut down. (In real clusters C picks many tokens, not one — see §4 on vnodes. The logic is the same, repeated.)
  2. C announces itself via gossip, in state BOOTSTRAPPING. Within a few rounds (§5), every node in the cluster knows two things: C's token is 25, and C is not ready yet. That second fact is what keeps reads away from it.
  3. A streams its existing [0, 25) data to C. Only rows whose hash falls in that range — not A's whole dataset. This is a direct file transfer of SSTable data, whole files where a range lines up cleanly and slices of files where it doesn't. It can take minutes or hours depending on how much data is involved.
  4. Meanwhile, every new write for [0, 25) goes to A and C. Step 3 only copies the past; the cluster is still taking writes while it runs. Sending each new write to both keeps C's copy growing alongside A's, so C has no backlog to chase at the end. A is still the real replica. While C is pending, coordinators also wait for one extra ack, which C can supply but doesn't have to (see “One Extra Ack While C Is Pending” below).
  5. Streaming finishes, C flips to NORMAL, and gossip spreads that. Only now does C start answering reads. A stops being asked about [0, 25) and keeps [25, 50).

Put the two halves of C's copy together and you can see why there's no gap. Step 3 gives C everything written before it joined. Step 4 gives C everything written during the join. Together that's everything — which is exactly the condition for flipping to NORMAL in step 5.

Who Answers What, and When

The same story as a table. Note that the reads column and the writes column behave differently — that asymmetry is the design:

PhaseWho answers reads for [0,25)?Who receives writes for [0,25)?
Before C joinsAA
While C is BOOTSTRAPPINGA — C is invisible to readsA and C — dual-write
After C goes NORMALCC

Reads go to exactly one place the whole time — A, then C, never both and never neither. A read has to return complete data, and C's copy is incomplete until the very last moment, so C is simply kept out of the read path until it isn't.

Writes go to both during the window — because a write doesn't need to be complete, it just needs to be somewhere. Sending it to both is cheap insurance that works no matter which node ends up serving the read.

Three phases for the range 0 to 25. Before C joins, A serves reads and receives writes. While C is bootstrapping, reads still go only to A, C is invisible to reads; every write goes to A, which counts toward the consistency level, and also to C as a pending replica whose ack can cover the one extra ack the coordinator waits for; meanwhile A streams its historical SSTable data to C. When streaming completes C flips to NORMAL, and reads and writes go to C. Gossip carries both state changes; no message ever tells A to stop.
Reads stay on A until C is complete; writes land on both while it catches up

The Two Things People Expect to Break

"Old data is moving — is it unavailable while it moves?"

No. A serves [0,25) reads through the entire transfer. Nothing is ever in transit from the client's point of view: the original stays fully live on A while a copy is built on C in the background.

"New writes arrive mid-move — do they get lost?"

No. That's step 4. Every write in the window lands on A, which is still the real replica and still counts toward your consistency level. C gets a copy too, and the coordinator waits for one extra ack to cover the handover.

Nobody Tells A to Stop — It Just Stops Being the Answer

One question is still open. Step 4 sends writes to A and C. Step 5 sends them to C alone. What flips the switch?

Nothing does. There is no "you're done with [0,25)" message, and A is never told anything at all. To see why, you need one more piece of the system: the coordinator.

First: What a Coordinator Is

A client never talks to "the owner of row 42" directly. It sends the request to any node, and that node becomes the coordinator for that one request. It is not elected and has no special role. The next request may pick a different node. For each request, the coordinator:

  1. Hashes the partition key to a token, for example row 42 → token 12.
  2. Looks up which nodes own that token in its own local copy of the ring, built from gossip.
  3. Forwards the read or write to those replicas and waits for enough acks to meet the consistency level.
  4. Replies to the client. The coordinator stores nothing about the request afterwards.

The coordinator can itself be one of the replicas, or it can just forward the request. The full mechanics, including token-aware clients that skip the extra hop, are in §6. For this section, step 2 is the part that matters:

A coordinator works out the replica set from scratch, from its current gossip view, on every single request. Nothing is cached between requests.

So "where does this write go?" is never a setting that has to be changed. It's a question asked fresh every time — and the answer changes on its own as gossip changes.

The coordinator answers it from a local table (TokenMetadata) holding two kinds of entries:

  • Normal ownership — who owns the range for real.
  • Pending ownership — who is currently being streamed the range but isn't NORMAL yet.

A lookup returns everything it finds in both. Walk it through the same three phases as before:

PhaseNormal owner of [0,25)Pending ownerLookup returns
Before C joinsA—A
C is BOOTSTRAPPINGACA + C → dual-write
C is NORMALC—C

A leaves the answer because both of its entries disappear at once: C takes over normal ownership of [0,25), and the pending entry is dropped the moment it's fulfilled. No flag set on A, no handoff message that could get stuck half-finished.

Gossip takes a few seconds to reach every node, so different coordinators move from row 2 to row 3 at slightly different moments. Both rows are safe to be sitting on:

  • Still on row 2 → the write goes to A and C. Correct, because A is still a complete replica.
  • Already on row 3 → the write goes to C alone. Also correct, because C is a complete replica too — it could not have reached NORMAL otherwise.

The cutover is safe because both answers are correct during the overlap. At the end of the window, a coordinator can't hold a view that drops or misroutes a write.

The Start of the Window: Waiting Out Gossip

The opposite edge is the risky one. Just after C announces BOOTSTRAPPING, coordinator X may already have heard and writes row 42 to A and C. Coordinator Y hasn't heard yet and writes row 43 to A only. C never receives row 43 as a dual-write.

Cassandra closes that gap by waiting before it copies anything:

C announces BOOTSTRAPPING
   │
   ▼
C waits RING_DELAY (~30 s)   ← gossip reaches every node in a few seconds
   │
   ▼
A flushes its memtable, then streams [0,25) to C

Any write that went to A alone was sent before the stream began, so it is already on A when the flush runs, and streaming carries it to C. By the time streaming starts, every coordinator knows C is pending, so each later write is sent to both nodes. Writes from before the announcement arrive through streaming, and writes after it arrive as dual-writes. Neither edge leaves a gap.

C isn't idle during the wait. Coordinators that have already heard about C send it dual-writes. C stores them but still serves no reads. Coordinators that haven't heard write to A only. So C's copy is patchy for those 30 seconds, and the flush-then-stream step fills it in.

Streaming Sends Some Data Twice, on Purpose

Streaming doesn't check what C already has. It sends everything A holds for [0,25) up to the flush point, so a write that reached C directly during the wait arrives a second time:

Write W @ 10:00:05  (coordinator already knew about C)
   ├─► A → flushed into A's SSTable → streamed to C   (copy 2)
   └─► C → C's memtable                               (copy 1)
  • Both copies are identical: same value, same timestamp. Reads merge them, the highest timestamp wins, and on identical data the result is the same. Compaction later keeps one copy.
  • Only a little data is duplicated: just the writes C got before A's flush, which is roughly the RING_DELAY window. Writes after the flush aren't in the streamed files, so they arrive once, as dual-writes.

Writes are idempotent: applying the same cell twice gives the same result as applying it once. So Cassandra can skip deduplication and simply send everything. That's simpler, and it's always safe.

Counters are no exception. Replicas don't exchange raw "+1" deltas. Each node's share of the counter is stored as (counter id, clock, count) state, and a merge keeps the copy with the higher clock. A duplicated share therefore doesn't double-count. The non-idempotent part of counters is a client retrying an increment, not streaming.

From One Copy to Three

So far every range has had one copy, on the node that owns it. That is RF=1, and it kept the picture simple. Real clusters run RF=3: each range is stored on the node that owns it and on the next two nodes clockwise around the ring. So every node does two jobs. It owns its own range, and it holds extra copies of the two ranges just before it.

To keep the names straight, A, B and C still mean nodes that own different ranges. The three copies of A's range are called A1, A2 and A3:

  • A1 is on node A, the owner.
  • A2 and A3 are on the next two nodes clockwise. Those nodes own ranges of their own, but here we only care about the copy of A's range they hold.

When C joins at token 25, it becomes the owner of [0,25). That slice's copies are now C plus the next two nodes clockwise, which are the nodes holding A1 and A2:

Copies of [0,25)
Before C joinsA1, A2, A3
After C goes NORMALC, A1, A2

At RF=3 the copy that drops out is the last one, A3, not A1. Node A keeps its copy of [0,25). A1 and A2 are in both sets, so they hold every write from before, during and after the join. Because A3 is the one losing the range, Cassandra streams [0,25) to C from A3. The five steps above, where A streams to C and then stops being asked, are the RF=1 case, where A's copy is the only one.

One Extra Ack While C Is Pending

A coordinator that sees a pending replica raises the number of acks it waits for by one: blockFor = CL + pending. Any replica's ack counts toward that total, natural or pending. With RF=3, [0,25) is on A1, A2 and A3 and C is joining:

CLNormalWhile C is pendingWhy
QUORUM2 of {A1, A2, A3}3 of {A1, A2, A3, C}Any 3 of these 4 include at least 2 of {C, A1, A2}, which is the replica set after the join.
ONE1 of {A1, A2, A3}2 of {A1, A2, A3, C}Any 2 of them include at least 1 of {C, A1, A2}.

The extra ack makes every acknowledged write already meet its consistency level in the new replica set as well as the old one. When C flips to NORMAL and A3 drops out, the guarantee survives.

This is why C's copy is called best-effort. C's ack isn't required: if C drops the write, A1, A2 and A3 can still supply the 3 acks. C may still end up with holes, but no acknowledged write depends on C alone. “C’s Holes Don’t Break Reads” below walks through why that is safe.

C's Disk: Old Data Lands in Newer Files

During the window, C builds SSTables from two sources at the same time:

SourcePath on CWhat's inside
Streaming from A (step 3)Written straight to SSTables, skipping the commit log and memtableOld data
Dual-writes (step 4)Commit log → memtable → flushed to SSTablesNew data

Streaming can finish after some flushes, so a streamed file can be created later than a live-write file while holding older data. That looks like a problem for "check newest first", but it isn't:

"Newest" always means newest data, never newest file. Every cell keeps its original write timestamp, and streaming copies that timestamp unchanged. Each SSTable records the min/max timestamp of the data inside it, and that range is what reads use to order and skip files. The file's creation time is never used.

Worked example: say S1 is a flushed live write, name = "Bob" @ 13:55. S2 is streamed later and holds name = "Alice" @ 09:00. A read merges the two and the highest timestamp wins, so the answer is Bob. If the read already holds Bob @ 13:55, it can skip S2 entirely, because S2's max timestamp of 09:00 is older and nothing in S2 could win. Arrival order never matters, so overlapping copies are always safe. (Read-side mechanics: Part 5 §2.)

C's Holes Don't Break Reads

Here is the worry, stated plainly. During the window C is allowed to miss writes, and nobody waits for its ack. Then C flips to NORMAL and starts serving reads, possibly still missing some rows. If a read lands on C, can it return a row that isn't there?

Not at QUORUM. A read never trusts a single replica. Correctness comes from overlap between the nodes that took the write and the nodes the read asks. It does not depend on every replica being complete. Cassandra makes one promise and deliberately leaves out the other:

Promised: the write overlaps every read quorum

Before the client hears "success", the write is on enough replicas that any later QUORUM read will reach at least one of them. That holds in the old replica set and in the new one. This is exactly what the extra pending ack buys.

Not promised: every replica has every row

C can have holes. So can any node after a GC pause, a reboot or a dropped message. Missing rows on one replica is the normal state of a Cassandra cluster, and repair exists to clean them up in the background.

A Worked Example

Continue the RF=3 setup from the extra-ack table: [0,25) lives on A1, A2 and A3, and C is joining. Writes and reads both use QUORUM.

  1. Row 42 is written while C is pending. The coordinator needs 3 acks from {A1, A2, A3, C}. C is busy streaming and drops the write, so A1, A2 and A3 supply the 3 acks. The client gets "success".
  2. C finishes streaming and flips to NORMAL. A3 drops out, so the replicas for [0,25) are now C, A1, A2. C is serving reads and still doesn't have row 42.
  3. A QUORUM read asks any 2 of {C, A1, A2}. Row 42 is on A1 and A2, which is 2 of the 3 new replicas, so every possible pair includes at least one node that has it.
Range 0 to 25 at RF 3, QUORUM writes and reads. Row 42 is written while C is pending and is acked by A1, A2 and A3; C drops it because it is busy streaming. C finishes streaming and flips to NORMAL, so A3 drops out and the replicas become C, A1 and A2, and C is still missing row 42. A QUORUM read asks any two of the three. Every possible pair, C and A1, C and A2, or A1 and A2, contains at least one node holding row 42, because A1 and A2 are two of the three new replicas. The newest timestamp wins and the read returns row 42.
C goes NORMAL with a hole — no QUORUM pair can miss row 42 anyway
Read asksDoes someone have row 42?
C + A1Yes, A1 has it
C + A2Yes, A2 has it
A1 + A2Yes, both have it

No pair misses. The coordinator merges the two answers, the highest timestamp wins, and the read returns row 42. C's empty answer simply loses the merge. Read repair can then write row 42 back to C as a side effect.

Without the extra ack, this could fail. A plain QUORUM write needs only 2 of {A1, A2, A3}. If it landed on A2 and A3, then after A3 drops out only A2 would hold the row, and a read of C + A1 would miss it. The pending ack is what guarantees the write reaches 2 of the new replicas, not just 2 of the old ones. This is also why the partitioned-coordinator case in the RING_DELAY callout above matters: a coordinator that never heard about C doesn't add the extra ack.

The guarantee was never "every replica is complete." It is "write replicas + read replicas > RF, so every read meets the write," and the pending ack keeps that true across the topology change. C's hole costs you a spare copy, not a correct answer, and read repair or nodetool repair fills it in afterwards.

  • Guarantees: No read is ever served by a node still bootstrapping, and no acknowledged write is lost — it landed on a natural replica and counted toward your consistency level before the client heard "success", whichever view the coordinator held.
  • Does not guarantee: That C received every write sent to it during the window. If C drops some, it goes NORMAL with holes — and streaming won't cover them, since streaming only carries data up to its flush point. Your data survives because the other replicas still hold it and quorums overlap; repair fills C in later. At RF=1 there is no such backstop. And the start-of-window coverage rests on RING_DELAY being long enough for gossip to reach every node, which is a timing assumption and not a hard guarantee.

When a Node Fails Instead

It is natural to assume a node failure triggers the same kind of range-split you just saw for a join. It doesn't — and this distinction matters more than almost anything else in this part.

The ring itself doesn't change. When a node stops responding, gossip's failure detector eventually marks it DOWN — but its token ranges are still assigned to it. No other node claims them. No streaming happens.

So how does data survive? Two things, neither of which is a range reassignment.

  1. Replication already put copies elsewhere. Everything so far in this part simplified to "one owner per range" to explain ring mechanics, but real clusters always set a replication factor (RF) > 1. Every range is written to RF different nodes, chosen by the replication strategy, up front — before any node ever goes down. With RF=3 and one replica down, the other two already hold full copies; nothing needs to be copied in response to the failure. Reads and writes at a level like QUORUM simply proceed on the replicas still up. Covered in depth in 03-replication-and-consistency.html.
  2. Writes the down node missed are handled by hinted handoff — not by another node adopting its tokens. The coordinator for that write — not necessarily a replica — stores a small "hint" (this write belongs to the down node, deliver it when it's back) and replays it once gossip shows the node UP again. (Pre-1.0 Cassandra handed the hint to another replica; modern versions keep it on the coordinator.) See Hinted handoff for how the coordinator decides a replica is down, and what happens if the node stays down past the hint window, which defaults to 3 hours.

The down node's tokens only change hands if a human tells them to:

  • Node comes back: it resumes owning its ranges and catches up via hints — or a full nodetool repair if it was down too long.
  • Node is permanently dead: an operator must explicitly change the topology. There are two ways, and the difference matters:
    • replace_address_first_boot — bring up a new machine that claims the dead node's exact tokens. The ring shape is unchanged; the replacement bootstraps those ranges by streaming from the surviving replicas. This is the normal answer to hardware failure.
    • nodetool removenode — evict the dead node and shrink the cluster. The surviving nodes claim its ranges, but they hold no data for them, so nodetool repair has to stream it in afterward.
    Both are covered in 09-operations.html.
Node joinsNode fails
Ring / token ownershipChanges immediately — new node claims tokensUnchanged until a human runs removenode
Triggered byThe new node itself, automaticallyAn operator, manually
Data movementStreaming, right awayNone until an operator replaces or removes the node — replicas already existed
What keeps things availableThe new node just isn't a read target yetThe other RF−1 replicas, which were always there

The Two Moments When a Failure Isn't Boring

Everything above is true while the cluster knows a node is down. But knowing takes time, and forgetting happens too fast. Those two edges of an outage behave differently from the calm middle:

A failed node is risky at exactly two moments — just after it dies, when nobody knows yet, and just after it returns, when everybody assumes it's healthy.

Moment 1 — Before the cluster notices (about 10 seconds)

A dead node doesn't announce that it died. Other nodes just stop hearing from it, and they need a few missed heartbeats before they're willing to call it down — roughly 10 seconds after a hard failure. (That patience is on purpose: §5 explains how the detector judges each node against its own heartbeat history so a slow network link doesn't get a node wrongly convicted.)

For those 10 seconds the node is dead but still believed alive, so coordinators keep sending it work that will never come back. Reads and writes handle that very differently:

Replicas the coordinator talks toOne dead replica among them
Write @ QUORUM, RF=3All 3, and waits for any 2 to ackAbsorbed. Two acks arrive normally, so the client never notices. The hint is written later, off the critical path.
Read @ QUORUM, RF=3Exactly 2, and needs bothExposed. No spare answer is in flight, so the read waits — rescued by speculative retry, or it fails with ReadTimeoutException.

The write asked three nodes a question it only needed two answers to, so it had a spare. The read didn't. That's the whole difference — and it's why a dead node usually shows up first as a latency spike on reads. See the read flow in Part 3 for the full step-by-step, including how speculative retry closes that gap.

Moment 2 — Right after it comes back

This one surprises people more. The moment gossip says the node is UP, it starts answering reads again — even though its hints are still replaying. It is knowingly missing data and is being asked questions anyway. There is no "catching up" state that holds reads off.

Compare that with the joining node from §2, which is also knowingly missing data. Cassandra treats the two in opposite ways:

Node joining (§2)Node returning (§3)
What it's missingEverything for its new range — streaming isn't doneA few hours of writes at most — hints still replaying
Starts serving readsOnly once it's provably complete (NORMAL)Immediately on UP
What protects youIt's simply never askedQuorum guarantees a fresh replica is in the set; the newest timestamp wins

The reason for the split is in the first row. A joining node would answer "no rows" — completely wrong, and no consistency level could rescue that, so it's kept out of the read path entirely. A returning node answers with slightly old data, which is exactly the problem quorum was built for.

So picture the actual read. At QUORUM/RF=3 the coordinator contacts 2 replicas — and if one of them is the node that just rejoined, you get a 1–1 split, not a majority of anything. The fresh value still wins, on its timestamp alone.

What quorum contributes is overlap, not numbers. The write was acked by 2 replicas and the read contacts 2 replicas; since 2 + 2 > 3, the two sets must share at least one node, and that node has the latest write. Quorum guarantees the fresh value is somewhere in the set you looked at; timestamp comparison is what picks it out. Read repair then pushes the winner back to whichever replica answered stale.

That safety net only exists if you use quorum. At CL=ONE the coordinator contacts a single replica, so there is no overlap guarantee at all — hit the node that just rejoined and its stale value is the only one in the set, so it wins by default rather than by beating anything. This is a common source of "Cassandra returned old data" reports.

  • Guarantees: A failure never causes data movement, and never causes a range to become unowned. Once the failure is detected, availability is entirely a function of RF and the consistency level you asked for.
  • Does not guarantee: That durability is restored automatically, or that the failure is free while it goes undetected. Reads can time out during the ~10s conviction window, and past the hint window the missed writes are gone from hints — only nodetool repair will reconcile that replica.

Virtual Nodes

In early Cassandra, each physical node owned exactly one token — one continuous arc of the ring. The problem: if you added nodes with different hardware capacity, or if a node failed, load distribution became uneven, and every repair or rebuild leaned on one unlucky neighbor.

Vnodes assign each physical node multiple smaller token ranges spread around the ring — default 256 tokens per node in older versions, 16 in newer ones.

The same four nodes on the same ring, drawn twice. Without vnodes each node owns one contiguous arc: A 0 to 25, B 25 to 50, C 50 to 75, D 75 to 100, so each node has only two neighbours. With vnodes each node owns many small arcs interleaved around the ring, for example A owns 0 to 5, 22 to 27, 51 to 56 and 78 to 83, so every node neighbours every other node. Total ownership per node is the same. Adding a node then takes a slice from every node, and replacing a dead node streams from all of them in parallel, but repair involves more ranges and more participants.
Same ownership per node — but interleaved, so every operation involves the whole cluster

What that last line in the diagram buys you — "every node neighbours every other node" — is the source of all three benefits below. Once ownership is interleaved, any operation that involves "my neighbours" involves the whole cluster.

  1. Uneven load when adding a node. A new node takes a few token ranges from every existing node, so load rebalances across all nodes simultaneously rather than draining just one neighbour.
  2. Slow rebuilds after failure. When a dead node is replaced, its ranges are spread across many nodes, so streaming happens in parallel from all of them. Recovery is dramatically faster than pulling everything from one predecessor.
  3. Heterogeneous hardware. Give a more powerful node more token ranges and it naturally handles proportionally more of the data — impossible when ownership is one indivisible arc.
  • Guarantees: Ownership granularity fine enough that adding, removing, or replacing a node is a parallel operation spread across the cluster rather than a serial one against a single neighbour.
  • Does not guarantee: Cheaper repair. Vnodes make repair strictly harder — more ranges, more participants. The rebalance win and the repair cost pull in opposite directions.

Gossip

Cassandra has no central coordinator and no ZooKeeper process. Nodes discover and track each other through gossip — a peer-to-peer protocol modelled on how rumours spread through a social network.

How It Works

Every second, each node:

  1. Picks 1–3 random peers from the cluster
  2. Exchanges its own state and the states it knows about other nodes
  3. Merges any newer information it receives

The state each node advertises:

Token rangeswhich arcs it owns
Current loadhow much data it's holding
Statusup, down, bootstrapping, leaving
Placementits datacenter and rack
Generationincremented on every restart
Heartbeatincremented every round

Generation and heartbeat together are how a receiving node decides whether incoming information is newer than what it already has — a higher generation always wins (the node restarted), and within the same generation the higher heartbeat wins.

Why This Is O(log N), Not O(N)

Every node that knows a piece of gossip tells a couple more each round, so the "knows it" group roughly doubles every round rather than growing by a fixed amount.

Sixteen nodes, five gossip rounds. In round 0 one node knows a piece of state. In each round every node that already knows tells one node that does not, so the informed set doubles: 1, 2, 4, 8, then all 16 nodes after round 4. After k rounds about 2 to the k nodes know, so full propagation takes about log base 2 of N rounds: 3 for 10 nodes, 7 for 100, 10 for 1,000.
The informed set doubles every round — full spread in about log₂ N rounds

You want to know when 2^k ≈ N. Solve for k:

k ≈ log₂(N)

That's the whole trick: doubling every round means you need only as many rounds as it takes to double your way up to N — not one round per node.

Cluster sizeRounds to full propagationWall-clock at ~1s per round
10 nodes~3~3 seconds
100 nodes~7~7 seconds
1,000 nodes~10~10 seconds

In practice it's a little slower than pure doubling, because random peer selection sometimes "wastes" a contact on a node that already knows — but that only adds a constant factor, it doesn't change the log N shape. This is the same math behind epidemic and rumour-spreading algorithms in distributed systems generally, not something unique to Cassandra.

Why This Eliminates ZooKeeper

ZooKeeper is a centralized coordination service. If ZooKeeper goes down, your cluster can't make decisions — and it's an extra distributed system to operate, monitor, and upgrade.

Gossip is fully decentralized. There is no single point of failure; every node independently builds its own picture of cluster membership. The coordinator for any given request is just the node that happened to receive the client connection, and it uses its own local gossip state to decide which nodes own the relevant token ranges.

  • Guarantees: Eventual convergence of membership and token state across every node, in O(log N) rounds, with no coordinator and no single point of failure.
  • Does not guarantee: That two nodes agree at any given instant. Gossip is eventually consistent about the cluster itself — which is exactly why §2's routing must be recomputed per request rather than cached.

The Coordinator Node

When a client sends a request to any Cassandra node, that node becomes the coordinator for that request.

  1. Hash the partition key to determine which nodes own the relevant token ranges
  2. Route the request to the correct replica nodes
  3. Collect enough acknowledgments to satisfy the requested consistency level
  4. Return the response to the client

The coordinator is not special. It is not elected, not a leader, not a master. Any node can coordinate any request, and the role exists only for the duration of that one request.

If the coordinator itself goes down mid-request, the client times out and retries, potentially landing on an entirely different coordinator. Nothing was stored on the coordinator that needs recovering.

Token-Aware Routing

Any node can be the coordinator. But if the client picks one at random, it will often pick a node that doesn't hold the data. That node then has to forward the request to the nodes that do. That forwarding is an extra network hop you didn't need.

Token-aware routing fixes this. The client driver keeps its own copy of the ring, so it knows which nodes own which tokens. For each request it:

  1. Hashes the partition key to get the token — the same calculation the server does
  2. Looks up which nodes own that token in its copy of the ring
  3. Sends the request straight to one of those replicas

That replica then does two jobs at once: it coordinates the request and stores the data.

Two ways to route one request at RF 3. With a random coordinator the client reaches node 7, which owns none of the data, and node 7 forwards to replicas 1, 2 and 3: two network hops before any replica sees the request. With a token-aware client that knows the ring, the client sends straight to replica 1, which acts as both coordinator and replica and forwards to replicas 2 and 3: one hop is gone, and coordination load lands on nodes that were doing the work anyway.
Token-aware routing removes one hop — the replica coordinates its own request
Random coordinatorToken-aware client
Hops before a replica sees the request21
Who does the coordinatingWhichever node the client or load balancer pickedA node that holds the data anyway
Where coordination load landsCan pile up on a few favoured nodesSpread out the same way the data is

In short: one less hop on every request, and the coordination work goes to nodes that were already doing the work.

  • Guarantees: Any node can serve any request correctly, regardless of what it owns — so a client needs no topology knowledge to be correct, and losing a coordinator loses nothing but one in-flight request.
  • Does not guarantee: That the coordinator is a replica. Without token-aware routing every request pays an extra hop, and coordination load piles onto arbitrary nodes rather than the ones holding the data.