当前位置:网站首页>[concurrent programming] consistency hash
[concurrent programming] consistency hash
2022-07-03 08:32:00 【keeper42】
Considering that every node of the distributed system may fail , And new nodes are likely to be added dynamically , How to ensure that the system can still provide good services when the number of nodes changes , It's worth considering , Especially when designing distributed cache system , If a server fails , For the whole system, if we do not use the appropriate algorithm to ensure the consistency , Then all data cached in the system may fail ( That is, because the number of system nodes becomes smaller , The client needs to recalculate an object when requesting it hash value ( Usually related to the number of nodes in the system ), because hash The value has changed , So it's very likely that the server node where the object is stored... Can't be found ), So consistency hash It's very important , Well distributed cahce Consistency in the system hash The algorithm should satisfy the following aspects :
- Balance (Balance)
Balance means that hash results can be distributed to all buffers as much as possible , This allows all buffer space to be used . Many hash algorithms can satisfy this condition .
- monotonicity (Monotonicity)
Monotonicity means that if something has already been hashed into the corresponding buffer , There are new buffers added to the system , Then the hash result should be able to ensure that the original allocated content can be mapped to the new buffer , Instead of being mapped to other buffers in the old buffer collection . Simple hash algorithm often can not meet the monotonicity requirements , Like the simplest linear hash :x = (ax + b) mod (P), In the upper form ,P Indicates the size of all buffers . It's not hard to see. , When the buffer size changes ( from P1 To P2), All the original hash results will change , Thus, it does not meet the requirement of monotonicity . The change in hash results means that when the buffer space changes , All mapping relationships need to be updated in the system . And in the P2P In the system , Changes in buffering are equivalent to Peer Join or exit the system , The situation is P2P It happens frequently in the system , Therefore, it will bring great calculation and transmission load . Monotonicity is that hash algorithm can deal with this situation .
- Dispersion (Spread)
In a distributed environment , The terminal may not see all the buffers , But only part of it . When the terminal wants to map the content to the buffer through the hash process , Because different terminals may see different buffer ranges , This leads to inconsistent hash results , The end result is that the same content is mapped to different buffers by different terminals . This situation should be avoided , Because it causes the same content to be stored in different buffers , Reduce the efficiency of system storage . Dispersion is defined as the severity of the above . A good hash algorithm should be able to avoid inconsistencies as much as possible , That is to minimize the dispersion .
- load (Load)
The load problem is actually looking at decentralization from another perspective . Since different terminals may map the same content to different buffers , So for a particular buffer , It can also be mapped to different content by different users . It's the same as dispersion , This situation should also be avoided , So a good hash algorithm should be able to reduce the load of buffer as much as possible .
- Smoothness (Smoothness)
Smoothness refers to the consistency between the number of cache servers and the number of cache objects .
边栏推荐
- 单调栈-503. 下一个更大元素 II
- Constraintlayout's constraintset dynamically modifies constraints
- Mxone Pro adaptive 2.0 film and television template watermelon video theme apple cmsv10 template
- Golang的range
- Kwai 20200412 recruitment
- Ue5 opencv plug-in use
- Graphics_ Learnopongl learning notes
- Go resolve ID card
- Image processing 8-cnn image classification
- Detailed explanation of all transfer function (activation function) formulas of MATLAB neural network
猜你喜欢
UE4 source code reading_ Bone model and animation system_ Animation process
jupyter远程服务器配置以及服务器开机自启
About the problem that the editor and the white screen of the login interface cannot be found after the location of unityhub is changed
C course design employee information management system
Mxone Pro adaptive 2.0 film and television template watermelon video theme apple cmsv10 template
Display terrain database on osgearth ball
数据分析练习题
About Wireshark's unsuccessful installation of npcap
Graphics_ Learnopongl learning notes
Unity learning notes
随机推荐
Basic operation and process control 2
Golang time format sorting
Collection interface
Cloudcompare learning (1) - cloudcompare compilation and common plug-in implementation
[audio and video] ijkplayer error code
Image processing 8-cnn image classification
Go resolve ID card
Jupyter remote server configuration and server startup
Scite change background color
Visual Studio (VS) shortcut keys
Thymeleaf 404 reports an error: there was unexpected error (type=not found, status=404)
MXone Pro自适应2.0影视模板西瓜视频主题苹果cmsV10模板
Solution détaillée de toutes les formules de fonction de transfert (fonction d'activation) du réseau neuronal MATLAB
Basic operation and process control
Transmit pictures with Base64 encoding
Base64编码简介
单调栈-503. 下一个更大元素 II
单调栈-42. 接雨水
Unity Editor Extension - Outline
Introduction to hexadecimal coding