Semicolony ELI5 · comic

Consistent hashing.

Placing servers around a clock face so adding one only nudges a few neighbours, not everyone.

  1. key % N srv 0srv 1srv 2 add one → almost all keys move
    1

    With plain key-%-N, the server count is baked in — change it and almost everything moves.

  2. seats round a ring
    2

    Consistent hashing seats the servers around a ring, like chairs around a clock face.

  3. key next server clockwise
    3

    Each key belongs to the next server clockwise from where it lands.

  4. only one arc moves
    4

    Add a server and it only steals one arc of keys — everyone else stays put.

  5. its arc passes to the next
    5

    Remove a server and its arc simply passes to the next one along.

  6. virtual nodes
    6

    Virtual nodes place each server at many points, so the load spreads evenly.

Seat servers and keys around a ring so adding or removing one only nudges a few.
Semicolony semicolony.dev/eli5/consistent-hashing/comic
← All ELI5 explainers