Expand description
Ketama consistent-hashing continuum.
For every live server we generate KETAMA_POINTS_PER_SERVER (160)
continuum points proportional to the server’s weight. Each set of 4
points is computed from a single MD5 digest of "<name>-<idx>",
pulling 32-bit slices out of the digest at offsets 0, 4, 8, and 12.
Lookups walk the sorted continuum and pick the first point with a
token strictly greater than the requested hash, wrapping back to the
beginning when the lookup falls past the end.
Structs§
- Continuum
- Sorted continuum, ready for
dispatch. - Continuum
Point - One entry on the continuum: a token and the index of the server that owns it.
- Server
Spec - Specification for one server in the continuum.
Constants§
- MAX_
HOSTLEN - Maximum length of
"<name>-<idx>"used to seed each digest. - POINTS_
PER_ HASH - Each MD5 digest yields 4 continuum points.
- POINTS_
PER_ SERVER - 160 points per server.