Jump consistent hash vs hash ring

Jump consistent hash vs hash ring is a choice between a constrained placement function and a flexible membership map.

Jump hash takes a key and a bucket count. It returns one sequential bucket ID with no stored ring. A hash ring stores positions for named nodes, so it can add or remove an arbitrary member.

Both minimize remapping when capacity changes. The useful question is whether your control plane can keep logical buckets stable when physical machines fail.

Jump consistent hash vs hash ring in one sentence

Jump consistent hash computes a bucket in the range 0 through N minus 1 using a few registers. Its lookup time grows with the logarithm of N, and the placement function stores no membership structure.

A ring hashes keys and node tokens into one circular space. Lookup finds the first token at or after the key position, usually with binary search over a sorted token list.

The original consistent hashing paper was designed for clients that could see different cache membership. Its spread and load properties address those inconsistent views.

Jump hash removes that flexibility on purpose. Every caller must agree on the same bucket count and the meaning of each sequential bucket ID.

Fanout's worked hash-ring explainer traces key movement, virtual nodes, and replication before this comparison narrows the algorithm choice.

Add a sixth bucket and count the movement

Suppose five equal buckets hold 12 million uniformly hashed keys. Adding a sixth bucket should move 12 million divided by 6, or 2 million keys.

Jump hash gives the new bucket about one sixth of all keys. Those keys move only from old buckets to bucket 5. Keys that do not jump keep their previous bucket number.

That is monotonic growth. The new bucket takes its final share without causing keys to move between two old buckets.

A balanced ring has the same target. New token positions split intervals previously owned by existing nodes, so roughly one sixth of keys should move to the new node.

The difference appears in who gives up the keys. Jump hash spreads the rebalance across old buckets without storing token positions.

A ring takes each new interval from its clockwise owner. Many virtual nodes scatter those intervals so the new physical node can draw smaller ranges from many peers.

One point per server rarely produces a balanced ring. Virtual nodes tighten the distribution, but every client or router must keep and search the larger token list.

Sequential bucket IDs are the jump constraint

Jump hash does not accept a set such as east-4, west-2, and west-9. It accepts N and returns an integer smaller than N.

With six buckets, the valid outputs are 0 through 5. Shrinking the count to five removes bucket 5 cleanly because the remaining IDs still fill 0 through 4.

Removing bucket 2 is different. Renumbering buckets 3 through 5 changes their identities and breaks the minimal-movement guarantee expected by the storage layer.

This is why the paper describes jump hash as better suited to data storage than distributed web caching. A durable shard can retain a stable number while replicas handle a machine failure.

A common design adds an indirection map. Jump hash selects logical bucket 2, then the map sends bucket 2 to its current primary and replicas.

If a server dies, the control plane changes the physical owner without changing the logical bucket count. Placement stays stable, but the system now stores and distributes a bucket-to-server map.

Indirection does not erase the constraint. It moves membership handling out of the hash function and into the control plane.

A hash ring pays for arbitrary membership

A ring can hash an arbitrary server identity to one or more positions. Removing that server deletes its tokens, and only the ranges owned by those tokens move clockwise.

That makes a ring natural for cache fleets and load balancers where instances can appear or disappear in any order.

The price is membership state. With 1,000 servers and 1,000 virtual nodes per server, the ring contains one million searchable positions before object overhead and replica metadata.

Damian Gryski's page-one comparison notes why those positions exist: too few virtual nodes leave wide ownership variance.

Jump hash avoids token memory and cache misses from searching a large ring. Its authors measured it as faster than their Karger-style implementations, especially as the point data outgrew processor caches.

Do not turn that benchmark into a universal latency promise. Hash function cost, language overhead, membership refresh, and the indirection layer can be larger than placement arithmetic.

The operational comparison is O(1) placement state plus constrained IDs against a searchable membership map plus arbitrary node identities.

Weights expose the same tradeoff

A ring can give a larger server more virtual nodes. If one machine should own twice the capacity, it can receive roughly twice the token count.

The resulting share is approximate because random token gaps still vary. More positions improve the approximation while increasing membership data and movement planning.

Jump hash assumes equal logical buckets. It has no physical server weights in its key-and-count interface.

Indirection can assign two logical buckets to a server that should carry twice the load. That handles integer ratios but increases bucket count and complicates a later change to a non-integer weight.

The LavinMQ comparison shows a practical version of the choice. It offers both ring and jump placement rather than treating one as a drop-in replacement for every exchange.

Weights also need a measurement target. Equal key counts do not imply equal bytes, CPU time, or request rates.

If one key is hot, neither more virtual nodes nor a better bucket distribution splits that key. Replication, caching, salting, or request-aware balancing must handle traffic skew separately.

Failure and replica placement stay outside both hashes

A ring can remove a failed member from placement, but the ring cannot prove that the member failed. Health checks, leases, gossip, or an operator supply that decision.

Every caller also needs a compatible ring version. Stale membership can route the same key to different owners during a change.

Jump hash needs a stable logical bucket after physical failure. The bucket map must point to a replica or replacement, and that map has the same versioning problem.

Replica selection is simpler to visualize on a ring: walk clockwise and choose distinct physical nodes. Virtual tokens on one server do not count as separate failure domains.

Jump hash returns one bucket. A production design needs another rule for replica buckets and must prevent duplicates.

Fanout's consistent-hashing ring implementation is a useful continuation for the membership and lookup mechanics.

Minimal remapping only bounds which keys change owners. It does not copy data, warm caches, throttle transfers, or decide when the new owner is safe to serve.

Choose from the control-plane contract

Use jump consistent hash when logical shards are numbered sequentially, capacity grows or shrinks at the upper end, and replication keeps a bucket alive through machine replacement.

Its strongest case is a storage service where every client agrees on N and a separate map assigns stable logical buckets to hardware.

Use a hash ring when members have arbitrary identities, individual nodes leave in any order, weighted capacity matters, or operators need explicit ranges for transfer and replicas.

Before choosing, answer five questions:

  • Does placement receive a bucket count or a membership set?
  • Can only the highest numbered bucket disappear?
  • Where are physical failures mapped to stable logical owners?
  • How are unequal capacities represented?
  • How does every caller learn the same placement version?

If the answers already require a rich membership map, the ring's stored state may be useful rather than wasteful.

If the answers reduce to a stable count of equal logical shards, a ring can be unnecessary machinery. Jump hash keeps the placement function small and leaves server identity where it belongs: in the control plane.