Menu

1 / 2

System Design 101: Consistent Hashing Explained

DEV Community·Balaji Yalla·6 months ago
#kaqAQj0a
#how#realworld#why#hash#server
Reading 0:00
15s threshold

Consistent Hashing

What Is It?

Consistent Hashing is a distributed hashing scheme that operates independently of the number of servers in a cluster. It ensures that when servers are added or removed, only a minimal number of keys (roughly $K/N$, where $K$ is the number of keys and $N$ is the number of servers) are redistributed.

Understanding Hashing First 🔑

Before diving into consistent hashing, let's understand what hashing is at its core.

1. What is Hashing?

Hashing is the process of taking an input of any size (a word, a file, a video, or an entire database row) and passing it through a mathematical formula (a Hash Function ) to produce a fixed-size string of characters or numbers, known as a Hash Value , Hash Code , or simply a Hash .

┌───────────────┐ ┌───────────────┐ ┌──────────────┐ │ Input Data │ ─────► │ Hash Function │ ─────► │ Hash Value │ │ (Any length) │ └───────────────┘ │ (Fixed size) │ └───────────────┘ └──────────────┘

Enter fullscreen mode

Exit fullscreen mode

Real-World…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.