当前位置:网站首页>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
边栏推荐
- Practical operation - Nacos installation and configuration
- Preparedstatement prevents SQL injection
- Pytorch notes - complete code for linear regression & manual or automatic calculation of gradient code comparison
- Pytorch学习记录(九):Pytorch中卷积神经网络
- 1. Calculate a + B
- A sharp tool to improve work efficiency
- 常用编程记录——parser = argparse.ArgumentParser()
- Framework analysis 2 Source code - login authentication
- Framework analysis 1 Introduction to system architecture
- Understanding and use of tp50, tp90 and tp99
猜你喜欢
去噪论文——[Noise2Void,CVPR19]Noise2Void-Learning Denoising from Single Noisy Images
Chapter 4 of line generation - linear correlation of vector systems
数字图像处理基础(冈萨雷斯)二:灰度变换与空间滤波
Pytorch學習記錄(十三):循環神經網絡((Recurrent Neural Network)
PyTorch笔记——观察DataLoader&用torch构建LeNet处理CIFAR-10完整代码
卡尔曼滤波与惯性组合导航
Opensips (1) -- detailed process of installing opensips
Pytorch learning record (V): back propagation + gradient based optimizer (SGD, adagrad, rmsporp, Adam)
深入理解去噪论文——FFDNet和CBDNet中noise level与噪声方差之间的关系探索
Font shape `OMX/cmex/m/n‘ in size <10.53937> not available (Font) size <10.95> substituted.
随机推荐
Fundamentals of digital image processing (Gonzalez) I
線性代數第一章-行列式
How to grow at work
Pyqy5 learning (4): qabstractbutton + qradiobutton + qcheckbox
SQL optimization best practices
lambda expressions
去噪论文阅读——[RIDNet, ICCV19]Real Image Denoising with Feature Attention
Kingdee EAS "general ledger" system calls "de posting" button
4. Print form
线性代数第三章-矩阵的初等变换与线性方程组
Comparative study paper - [Moco, cvpr2020] momentum contract for unsupervised visual representation learning
Reading of denoising paper - [ridnet, iccv19] real image denoising with feature attention
Paper on LDCT image reconstruction: edge enhancement based transformer for medical image denoising
Pytorch learning record (XII): learning rate attenuation + regularization
What is the difference between the basic feasible solution and the basic feasible solution in linear programming?
RPC must know and know
Algèbre linéaire chapitre 2 - matrice et son fonctionnement
图解numpy数组矩阵
自动控制(韩敏版)
SQL injection