Video summary

Consistent Hashing - System Design

Main summary

Key takeaways

Technology

Summary

The video explains consistent hashing as a way to scale systems across multiple database servers while minimizing how much data must move when servers are added or removed.

Why hashing is needed

A hash function maps a key, such as a user ID, to a database partition. It should return the same result for the same input so that data can be retrieved from the partition where it was stored. A simple approach is:

key % number_of_servers

The problem with modulo hashing

Changing the number of servers changes the result for many keys. For example, adding a fourth server to a three-server setup can require substantial data redistribution, making scaling disruptive.

How consistent hashing works

Servers and data keys are mapped to positions on a circular hash space, or ring. To find a key’s server, move clockwise from the key’s position to the first server encountered.

When servers are added or removed, only keys in the affected range of the ring need to be reassigned. Keys elsewhere can remain in place, substantially reducing data movement compared with basic modulo hashing.

Virtual nodes

A server can be represented by multiple positions on the ring. This helps distribute responsibility more evenly when server positions are unevenly spaced and reduces the chance that one server receives a disproportionate share of keys.

Limitations and related concerns

Consistent hashing reduces redistribution but does not guarantee perfectly balanced load or eliminate hotspots. The video mentions the celebrity problem, in which unusually popular data can overload a partition.

Guide and tutorial content

The video provides a step-by-step conceptual walkthrough: it starts with ordinary hashing and modulo-based partitioning, demonstrates the remapping problem, then introduces the hash ring, clockwise lookup, server changes, and virtual nodes. It also refers to an explanatory article or diagram about affected key ranges. No product reviews are presented.

Main speaker and sources

  • Main speaker: Piyush Garg
  • Other sources mentioned: An explanatory article or diagram on consistent hashing
  • Real-world systems cited: Amazon DynamoDB and Apache Cassandra

Rate this summary

Your feedback will help improve summaries.

Improve this summary

Reprocess with a stronger model when the summary feels incomplete or inaccurate.

Pro

Translate summary in another language

Pro

Ask questions to this video

Chat for follow-up questions, clarifications, and source-backed answers.

Coming soon

Share this summary

Original video