当前位置:网站首页>Consistent hash algorithm used for redis cache load balancing
Consistent hash algorithm used for redis cache load balancing
2022-04-23 06:09:00 【commonBean】
Link to the original text
Due to the poor scalability and fault tolerance of cache load balancing realized by ordinary hash algorithm , So we introduce a consistent hash algorithm .
One sentence generalizes the consistency hash : It is an improved version of the common modular hash algorithm , Hash function calculation method remains unchanged , It's just by building rings Hash Space instead of ordinary linear Hash Space .
operation
- Choose one big enough Hash Space ( It's usually 0 ~ 2^32) Form a hash ring .
- For each storage server node in the cache cluster Hash value , The service node is Hash Position on the ring .
- For every data that needs to be stored key The hash value is also calculated once , The computed hash is also mapped to the ring
advantage :
- The expansion ability is improved
When you need to add nodes , Only part of the data of the next node is affected , Migrate the data to a new node . - Improved fault tolerance
When a node fails , Only the current node is affected , It will not affect the data of other nodes , Just save the node data to the next node in the clockwise direction .
The problem is :
- Data skew
The nodes are unevenly distributed after hashing algorithm , This results in a large amount of data stored on a node - Node avalanche
1, Due to data skew, the node request pressure is too high and hangs up
2, The node is down for some reason , This will cause all the data of this node to be transferred to the next node , The next node hangs up because the request is too large
3, For the above reasons, after the node hangs up , The data goes to the next node , The next node also hangs up due to excessive pressure ... Cause all nodes to hang up , Cause node avalanche
Solution
How to solve data skew and node avalanche ?
- Virtual node
It is to virtual a few of its avatar nodes on the hash ring for the original single physical node , These spin off nodes are called 「 Virtual node 」. In fact, the data printed to the sub body node is also mapped to the physical node corresponding to the sub body , Such a physical node can be evenly distributed in all parts of the hash ring through the way of virtual nodes , Solve the problem of data skew .
版权声明
本文为[commonBean]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220533053457.html
边栏推荐
- 7.Domino piling
- Preparedstatement prevents SQL injection
- Pytorch学习记录(四):参数初始化
- 5.The Simple Problem
- PyTorch笔记——通过搭建ResNet熟悉网络搭建方式(完整代码)
- 在Jupyter notebook中用matplotlib.pyplot出现服务器挂掉、崩溃的问题
- Pyqy5 learning (4): qabstractbutton + qradiobutton + qcheckbox
- PyTorch笔记——观察DataLoader&用torch构建LeNet处理CIFAR-10完整代码
- Treatment of tensorflow sequelae - simple example record torch utils. data. dataset. Picture dimension problem when rewriting dataset
- 2. Devops sonar installation
猜你喜欢

Automatic control (Han min version)

Framework analysis 1 Introduction to system architecture

sklearn之 Gaussian Processes

Contrôle automatique (version Han min)

JDBC connection database

Latex快速入门
![去噪论文阅读——[CVPR2022]Blind2Unblind: Self-Supervised Image Denoising with Visible Blind Spots](/img/fd/84df62c88fe90a73294886642036a0.png)
去噪论文阅读——[CVPR2022]Blind2Unblind: Self-Supervised Image Denoising with Visible Blind Spots
![Denoising paper - [noise2void, cvpr19] noise2void learning denoising from single noise images](/img/9d/487c77b5d25d3e37fb629164c804e2.png)
Denoising paper - [noise2void, cvpr19] noise2void learning denoising from single noise images

Latex quick start

PyTorch笔记——实现线性回归完整代码&手动或自动计算梯度代码对比
随机推荐
深度学习基础——简单了解meta learning(来自李宏毅课程笔记)
Pytorch learning record (V): back propagation + gradient based optimizer (SGD, adagrad, rmsporp, Adam)
20 excellent plug-ins recommended by idea
How to use comparative learning to do unsupervised - [cvpr22] training & [eccv20] image translation
数字图像处理基础(冈萨雷斯)二:灰度变换与空间滤波
List segmentation best practices
String notes
Pytorch学习记录(五):反向传播+基于梯度的优化器(SGD,Adagrad,RMSporp,Adam)
Latex quick start
On traversal of binary tree
Pytorch学习记录(四):参数初始化
4. Print form
Problems and solutions of database migration
Denoising paper - [noise2void, cvpr19] noise2void learning denoising from single noise images
Pytorch学习记录(九):Pytorch中卷积神经网络
无监督去噪——[TMI2022]ISCL: Interdependent Self-Cooperative Learning for Unpaired Image Denoising
Contrôle automatique (version Han min)
1. Calculate a + B
You cannot access this shared folder because your organization's security policy prevents unauthenticated guests from accessing it
Unsupervised denoising - [tmi2022] ISCL: dependent self cooperative learning for unpaired image denoising