当前位置:网站首页>Distributed locks and three implementation methods
Distributed locks and three implementation methods
2022-07-31 03:11:00 【1.01】
I. What is a distributed lock
Distributed locks are a way to control synchronous access to shared resources between distributed systems. In order to prevent multiple processes in a distributed system from interfering with each other, it is necessary to coordinate these processes on different machines.
If one or a group of resources are shared between different systems or different hosts of the same system, when accessing these resources, mutual exclusion is often required to prevent mutual interference and ensure consistency. At this time, it is necessary toUse distributed locks.
Distributed locks should have the following conditions:
- In a distributed system environment, a method can only be executed by one thread of one machine at a time;
- Highly available acquire lock and release lock;
- High-performance lock acquisition and release;
- It is reentrant;
- Have a lock failure mechanism to prevent deadlock;
- It has the feature of non-blocking lock, that is, if the lock is not acquired, it will directly return the failure to acquire the lock.
Second, the way to realize distributed lock
Implementation | Link |
---|---|
Distributed lock based on database | Click to view |
Distributed lock based on cache (Redis) | Click to view |
The principle of distributed lock based on Zookeeper | Click to view |
In terms of ease of understanding (from low to high)
Database > Cache > Zookeeper
From an implementation complexity perspective (low to high)
Zookeeper >= cache > database
From a performance perspective (high to low)
Cache> Zookeeper >= Database
From a reliability perspective (high to low)
Zookeeper > Cache > Database
边栏推荐
- 4、敏感词过滤(前缀树)
- 【编译原理】递归下降语法分析设计原理与实现
- Golang中的addressable
- Discourse 自定义头部链接(Custom Header Links)
- Software accumulation -- Screenshot software ScreenToGif
- CorelDRAW2022 streamlined Asia Pacific new features in detail
- The use of font compression artifact font-spider
- 【Cocos Creator 3.5】缓动系统停止所有动画
- Analysis summary - self-use
- Chapter 9 SVM实践
猜你喜欢
C# remote debugging
10. Redis implements likes (Set) and obtains the total number of likes
共模电感的仿真应用来了,满满的干货送给大家
VS QT——ui不显示新添加成员(控件)||代码无提示
MultipartFile file upload
Addition and Subtraction of Scores in LeetCode Medium Questions
什么是系统?
8、统一处理异常(控制器通知@ControllerAdvice全局配置类、@ExceptionHandler统一处理异常)
The distance value between two arrays of LeetCode simple questions
Office automation case: how to automatically generate period data?
随机推荐
LeetCode中等题之分数加减运算
Detailed explanation of TCP (3)
Discussion on Service Commitment of Class Objects under Multithreading
The simulation application of common mode inductance is here, full of dry goods for everyone
Redis实现分布式锁
【Cocos Creator 3.5】缓动系统停止所有动画
刚出道“一战成名”,安全、舒适一个不落
Modbus on AT32 MCUs
[C language foundation] Solve C language error: expected ';', ',' or ')' before '&' token
学习DAVID数据库(1)
els 方块向右移
YOLOV5 study notes (2) - environment installation + operation + training
7年经验,功能测试工程师该如何一步步提升自己的能力呢?
数据库实现分布式锁
点云DBSCAN聚类(MATLAB,非内置函数)
WebSocket Session为null
递归查询单表-单表树结构-(自用)
Day32 LeetCode
【编译原理】递归下降语法分析设计原理与实现
7、私信列表