当前位置:网站首页>There are some limitations in cluster expansion and contraction
There are some limitations in cluster expansion and contraction
2022-06-23 08:13:00 【User 7737280】
such as : A server node is down , The calculation formula starts from hash(key)% 3 Turned into hash(key)% 2, The results will change , At this point, you want to access a key, This key Open selection The approximate cache location rate will change , So before caching key The data will also lose its function and significance .
A large number of caches fail at the same time , Avalanche causing cache , This leads to the unavailability of the whole cache system , This is basically unacceptable , In order to solve and optimize the above situation , Uniformity hash The algorithm came into being ~ that , How does the consistent hash algorithm solve the above problems ?
The server maps to hash Ring At this time, the calculation formula starts from hash(key)% N Turned into **hash( The server ip)% 232**, Use the server IP address hash Calculation , Use the hash result to 232 modulus , The result must be a 0 To 2^32-1 Integer between , And this integer is mapped to hash The position on the ring represents a server , In turn node0、node1、node2 Open selection Three cache servers are mapped to hash On the ring . How does it optimize the addition and reduction of nodes in the cluster ,http://www.gongxuanwang.com Cache service caused by common modulo algorithm , The problem of large area unavailability ?
Let's take a look at the scenario of capacity expansion , If business volume surges , The system needs to be expanded to add a server node-4, just node-4 Mapped to node-1 and node-2 Between , Object mapping nodes in a clockwise direction , Found originally cached in node-2 On the object key-4、key-5 Is remapped to node-4 On , Open selection However, during the whole expansion process, only node-4 and node-1 A small amount of data between nodes . Uniformity Hash The algorithm introduces a Virtual node Mechanism , That is, calculate multiple for each server node hash value , They all map to hash On the ring , Objects mapped to these virtual nodes key, It will eventually be cached on the real node .
Virtual node hash The calculation can usually adopt , Of the corresponding node IP Address plus number suffix hash(10.24.23.227#1) The way , for instance ,node-1 node IP by 10.24.23.227, Normal calculation node-1http://www.gongxuanwang.com Of hash value .
hash(10.24.23.227#1)% 2^32Suppose we give node-1 Set up three virtual nodes ,node-1#1、node-1#2、node-1#3, Carry them on hash Take the mold after .
边栏推荐
- PHP file contains -ctf
- C Scrollview scroll up or scroll down
- [cross border e-commerce solutions] lighthouse will be used for pure IP expansion of new business - continuous efforts!
- Vulnhub | dc: 3 | [actual combat]
- Socket programming (multi process)
- C# richTextBox控制最大行数
- 【Try to Hack】ip地址
- Mathematical knowledge: fast power inverse element - fast power
- Markdown学习
- 船长阿布的灵魂拷问
猜你喜欢

Create an orderly sequence table and perform the following operations: 1 Insert element x into the table and keep it in order; 2. find the element with the value of X, and delete it if found; 3. outpu

Display proportion of sail soft accumulation diagram

On ThreadLocal and inheritablethreadlocal, source code analysis

How to start Jupiter notebook in CONDA virtual environment

如何在conda虚拟环境开启jupyter-notebook

走好数据中台最后一公里,为什么说数据服务API是数据中台的标配?

Introduction to Excel VBA and practical examples

看了5本书,我总结出财富自由的这些理论

值得反复回味的81句高人高语

vtk.js鼠標左鍵滑動改變窗比特和窗寬
随机推荐
GTEST death test
Regular expression use cases
数据资产为王,解析企业数字化转型与数据资产管理的关系
Configuration asmx not accessible
观察者模式
[cross border e-commerce solutions] lighthouse will be used for pure IP expansion of new business - continuous efforts!
QT project error: -1: error: cannot run compiler 'clang++' Output:mingw32-make. exe
力扣(LeetCode)173. 二叉搜索树迭代器(2022.06.22)
MySQL brochure notes 5 InnoDB record storage structure
Apache Solr 任意文件读取复现
爬虫框架
VTK. Le bouton gauche de la souris JS glisse pour changer le niveau et la largeur de la fenêtre
firewalld 配置文件的位置
openni. utils. OpenNIError: (OniStatus.ONI_STATUS_ERROR, b‘DeviceOpen using default: no devices found‘
Location of firewalld configuration file
81 sentences worth repeating
建立一有序的顺序表,并实现下列操作: 1.把元素x插入表中并保持有序; 2.查找值为x的元素,若找到将其删除; 3.输出表中各元素的值。
On ThreadLocal and inheritablethreadlocal, source code analysis
aquatone工具 中的2个bug修复
深度学习------不同方法实现lenet-5模型