DEV Community

Vidya
Vidya

Posted on

1

Key points of Consistent Hashing

Key points of Consistent Hashing

The key to understand Consistent Hashing is to understand the following:

  1. We not only hash the key IDs but also the server/node IDs. Modulo hashing works well for a fixed number of servers. However in reality servers can go down and become unavailable; so a fixed number of servers cannot be assumed.

  2. Server IDs are hashed to a fixed range. The key IDs are also hashed to the same fixed range. Can imagine this range to be like a circle.

  3. The key IDs are then routed to the closest server in the clockwise direction (It can be anticlockwise as well, as long as the same direction is used for all the keys).

  4. Finally, only a single hashing algorithm need not be used. We can use multiple hashing algorithms to make the servers spread out across the circle. Thus the load can be distributed in a better manner.


Ref:

  1. Visual simulation of consistent hashing

  2. What is Consistent Hashing and Where is it used?

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️