当前位置:网站首页>Advantages and disadvantages of redis and ZK implementing distributed locks
Advantages and disadvantages of redis and ZK implementing distributed locks
2022-07-24 08:18:00 【Brother Mao 01】
Redis Realization
advantage : Good performance
shortcoming :
To someone redismaster example , Written myLock This kind of lock key Of value, At this time, it will be asynchronously copied to the corresponding masterslave example .
But once that happens redismaster Downtime , Active standby switching ,redisslave Change into redismaster.
And then it leads to , client 2 To try to lock , In the new redismaster It's locked on , And the client 1 I think I've successfully locked it .
At this time, it will cause multiple clients to lock a distributed lock .
At this time, the system will have problems in business semantics , Lead to the generation of all kinds of dirty data .
So this is rediscluster, Or is it redismaster-slave The master-slave asynchronous replication of the architecture results in redis The biggest drawback of distributed locks : stay redismaster When the instance goes down , It may cause multiple clients to lock at the same time .
ZK Realization
advantage : Highly reliable zk Itself through leader+quorum High reliability of mechanism guarantee .
shortcoming :ZooKeeper Implementation of distributed lock , The performance is not very high . Why? ?
Because every time you create a lock and release a lock , All need to be created dynamically 、 Destroy the instantaneous node to realize the lock function . As we all know ,ZK You can only create and delete nodes through Leader Server to execute , then Leader The server also needs to synchronize data to all servers Follower On the machine , Such frequent network communication , The short board of performance is very outstanding .
边栏推荐
- mysql使用explain分析sql执行计划帮助查找性能瓶颈
- Adaptive problem of img aspect ratio scaling in flex layout in Safari
- JS to get the default language of the current browser
- [target detection] IOU (intersection and combination ratio)
- [wechat applet development] (III) homepage banner component uses swiper
- 【MATLAB】(三)MATLAB在高等数学中的应用
- [MySQL] 08: aggregate function
- Perceptron and multilayer neural network, back propagation and computational graph
- [wechat applet development (III)] realize the stacking and sliding of cards
- P1305新二叉树题解
猜你喜欢

Wechat applet file types and functions

Cososcreator upgrade gradle version
![[wechat applet development] (I) development environment and applet official account application](/img/94/b93d5fb6d9e3515a1f218cc4ec6eef.png)
[wechat applet development] (I) development environment and applet official account application

SVM linear separable linear support vector machine

Robert operator, Sobel operator, Laplace operator

JMX Console 未授权访问漏洞

T-SQL query statement

FPGA综合项目——图像边缘检测系统

Enterprises love hybrid app development, and applet container technology can improve efficiency by 100%
![[wechat applet development] (II) wechat native bottom tabbar configuration](/img/74/5f5da7ea47f95a25011ba52959f480.png)
[wechat applet development] (II) wechat native bottom tabbar configuration
随机推荐
Stack / heap / queue question brushing (Part 2)
13. Unity2d horizontal version of two-way platform that can move up, down, left and right (two-way walking + movable + independent judgment) + random platform generation
Learning dynamic Siamese network for visual object tracking full text translation
JMX Console 未授权访问漏洞
[technical interview] how to introduce yourself
Is it safe to open an account online in Beijing
Why is knowledge base important? This is the best answer I've ever heard
EZDML reverse engineering import database analysis practical operation tutorial
[golang from introduction to practice] student achievement management system
jmeter中JSON提取器使用
Android kotlin uses a coroutine instead of a callback function (suspendcoroutine usage)
Wechat payment V3 version of openresty implementation and pit avoidance Guide (service side)
[Yum] configuration and use of Yum source
Database system - Basic Concepts
【MySQL】08:聚合函数
SVM linear separable linear support vector machine
Go: how to gracefully time out
Generative model and discriminant model
【MATLAB】(四)MATLAB在线性代数中的应用
Adaptive problem of img aspect ratio scaling in flex layout in Safari