“Consistent hash is designed to address distributed caching, not only to hash, but also to move data as little as possible when a server goes down. It is therefore widely used for routing functions in state services.”
01
–
Routing algorithms for distributed systems
Suppose you have a push message system with the following simple architecture
02
–
What is a consistent hash algorithm
03
–
Application of consistent Hash in the system
-
First, select the corresponding cluster according to the number segment, which is configurable
-
After the cluster is determined, the device is matched to an instance of the server based on the consistent hash (multiple device access layer instances are deployed on each server (1). Each instance holds more scattered state information; 2. Service gc issues will be alleviated)
-
Create a virtual node for the machine: reverse the order of users (scramble the previous consecutive userids) to form a new resource segment. The virtual server node is created
-
Record the number of devices that each server locks. If machine A fails, select the machine with the least number of devices to accept kicked-device
04
–
Not all cases are suitable for consistent hashing
Click to subscribe for more highlights
Your forwarding is the biggest support for me
If you gain anything, please click it and watch it, thanks sincerely