A Simple Implementation Of Consistent Hashing

Trần Thiện Khiêm
2 min readMar 11, 2022

Let’s say that you have M tasks, and you want to distribute to N servers. Here is the interface of the class we are going to build:

We have a class called ConsistentMap and a get operation where we want to get an assigned server that we want to execute the task.

--

--

Trần Thiện Khiêm

Software Engineer at Facebook — a coder, a dreamer and a Dota 2 Herald.