All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Register

Login


All New Register Login

linkjobai

Joined 1794542739

Recently created
Least recently created
Recently updated
Least recently updated
All gists 1

linkjobai / Consistent Hashing Explained for System Design Interviews

0 likes
0 forks
1 files
Last active 1794542740
Interview prep notes
interview

Consistent Hashing Explained for System Design Interviews

When you shard a cache or database with hash(key) mod N, adding or removing one server remaps almost every key. Consistent hashing limits the damage to roughly 1/N of the keys.

How it works

  1. Map servers and keys onto the same ring of hash values (for example 0 to 2^32 - 1).
  2. A key belongs to the first server clockwise from its position.
  3. When a server joins, it takes keys only from its clockwise neighbour; when one leaves, its keys move to the next server.
Newer Older

Powered by Opengist ⋅ Load: 47ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文