HASH · ROUTE · COMPARE

Cassandra token ring

Inspect exact text-key tokens, stable virtual-node ranges and the keys affected by a node join.

Exact routing decision

Ownership and movement

    Hashing and ownership are separate

    The entered text is encoded as UTF-8 and hashed to a signed 64-bit token using Cassandra-compatible Murmur3 behavior. The key token does not depend on the node count. Routing chooses the first vnode token greater than or equal to the key token, wrapping around the ring when necessary. That vnode owns the interval after the previous token through its own token, with an exclusive lower boundary and inclusive upper boundary. The exact integer boundaries remain visible in the inspector; floating-point canvas positions are only a visual approximation.

    Change the topology deliberately

    Physical nodes controls the number of distinct owners. Vnodes per node chooses how many assigned positions each owner has. Layout seed chooses a reproducible teaching layout. Each node and vnode identity receives a stable token within that seed, so Add one node preserves the existing assignments instead of redrawing everything randomly. Next layout seed intentionally creates a different layout; this is not a production rebalance operation. Replica count walks clockwise and selects distinct node identities, skipping additional vnodes belonging to an already selected node. It cannot exceed the number of physical nodes. Partition key updates the route immediately; Route key also restarts that calculation without changing ownership.

    Predict a join before comparing it

    Start with six nodes, eight vnodes and seed one. Record the key token and primary owner, then add a node. The hash remains unchanged, but ownership changes if a new vnode falls between the old interval boundary and the key. Compare the movement count over two hundred fixed sample keys. Every changed primary in this join-only fixture moves to the newly added node; unchanged ranges stay with their prior owners. Change the layout seed to see a different kind of redistribution. Increasing vnode count does not guarantee perfect balance: inspect the exact ownership shares instead of assuming identical loads.

    Inspect the limits

    Play reveals hashing, primary selection and replica selection across sixty teaching seconds. Pause holds the visualization, Next stage advances a phase, Restart rewinds with the same topology, Speed changes playback, and Inspection seconds scrubs. This is not a timing benchmark or a request sent around the ring. The lab hashes one text value, not Cassandra composite partition-key serialization. Empty text displays the partitioner's minimum-token sentinel, not a supported empty CQL key insertion. Synthetic vnode placement is not Cassandra's allocation algorithm. Replica selection is a single-ring distinct-node policy, without datacenters, racks, NetworkTopologyStrategy, consistency levels, data streaming or failure handling. Primary token-space share is not disk usage, replica storage share or a workload measurement.

    References: Cassandra partitioning architecture and partitioner implementation. All example data and node identities are local fixtures.