Grokking the System Design Interview
Vote

0% completed

Consistent Hashing

Most systems spread data across several machines. The simplest rule for picking a machine is hash(key) % n, where n is the number of machines. It is fast, and it spreads keys evenly.

It has one bad property. The count of machines is part of the rule. Change the count, and almost every key belongs somewhere else.

Consistent hashing is a different rule for mapping keys to machines. When you add or remove one machine, only a small share of the keys move. Everything else stays where it was.

Why hash(key) % n Breaks

Say you have four machines and you add a fifth

.....

.....

.....

Like the course? Get enrolled and start learning!
Gitith T

Gitith T

· a month ago

The diagram for consistent hash with virtual nodes is misleading, the ranges are randomised but in the given diagram it's in the order Server 1 -> Server 2 -> Server 3 -> Server 4 -> Server 1. If it follows perfect, repeating, sequential order, it offers no benefits compared to just consistent hashing without any virtual nodes.

In a consistent hashing with virtual nodes, the ranges are randomised such that there are multiple possibilities of having a different server as the next server for all it's ranges.

G

Gokul S

· 4 years ago

Are you planning to add new content to this course? There has not been an update over a year or so. Things in the distributed space are evolving rapidly. For example, NewSQL databases and design examples using these.

Show 1 reply
J

Juan Jose Jaramillo

· 4 years ago

I like that you mark progress with check marks, but they only consider time. I can leave a page open, leave my desk, and come back to a lesson to see it marked as completed. Can you add functionality to allow the user to reset a lesson to the original, unmarked, state?

Show 1 reply
J

Jharol Rivera

· 4 years ago

it should be an option to highlight and take notes on the page.

Show 2 replies

Reading Progress

0%