当前位置:网站首页>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 .
边栏推荐
- [matlab] (III) application of MATLAB in Higher Mathematics
- 55. Jumping game
- Crypto bear market: some people expand on a large scale, some layoffs shrink
- Hegong sky team vision training day4 - traditional vision, contour recognition
- Decision tree - ID3, C4.5, cart
- Cmake binary installation
- [golang from introduction to practice] student achievement management system
- What is the difference between domestic "rocket heart" artificial heart and different artificial heart?
- P1305新二叉树题解
- Perceptron and multilayer neural network, back propagation and computational graph
猜你喜欢

33 introduction to sparksql, dataframe and dataset

Why is knowledge base important? This is the best answer I've ever heard

Wechat applet subscription message development process
![[redis] how much do you know about bloom filter and cuckoo filter?](/img/f0/8bcbe82bd6d412e68d85450f5894e3.png)
[redis] how much do you know about bloom filter and cuckoo filter?

JSON extractor use in JMeter

Decision tree - ID3, C4.5, cart

Full revolutionary Siamese networks for object tracking translation

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

学习笔记总结篇(一)

My six months at Microsoft
随机推荐
Solution of p3916 graph traversal problem
栈/堆/队列刷题(下)
Wechat payment V3 version of openresty implementation and pit avoidance Guide (service side)
*Code understanding *numpy basic (plus code) that must be understood
EZDML逆向工程导入数据库分析实操教程
[wechat applet development] (IV) uni app from getting started to giving up
Introduction to wechat authorized login third-party app applet method
[database] complete SQL statement
基于thinkphp将execle表格上传并插入数据库
how to add square on screenshot
避坑,职场远离PUA,PUA常见的套路与话术你得了解一下!
warning: could not execute support code to read Objective-C class data in the process.
Wechat official account configures custom menu jump applet and automatically replies to jump applet
Detailed notes on pytoch building neural network
Kotlin higher order function & DSL layout persuasion Guide
MySQL日期格式化
Saining Techtalk attack and defense drill: attack combination fist "stable, accurate and ruthless" penetration
Poj3278 catch the cow
The difference between online learning and offline learning
A knight's journey