File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -365,6 +365,14 @@ private static class LockData
365
365
366
366
## 总结
367
367
368
- 这篇文章我们介绍了实现分布式锁的两种常见方式。至于具体选择 Redis 还是 ZooKeeper 来实现分布式锁,还是要看业务的具体需求。如果对性能要求比较高的话,建议使用 Redis 实现分布式锁。如果对可靠性要求比较高的话,建议使用 ZooKeeper 实现分布式锁。
368
+ 在这篇文章中,我介绍了实现分布式锁的两种常见方式: Redis 和 ZooKeeper。至于具体选择 Redis 还是 ZooKeeper 来实现分布式锁,还是要看业务的具体需求。
369
+
370
+ - 如果对性能要求比较高的话,建议使用 Redis 实现分布式锁(优先选择 Redisson 提供的现成的分布式锁,而不是自己实现)。
371
+ - 如果对可靠性要求比较高的话,建议使用 ZooKeeper 实现分布式锁(推荐基于 Curator 框架实现)。不过,现在很多项目都不会用到 ZooKeeper,如果单纯是因为分布式锁而引入 ZooKeeper 的话,那是不太可取的,不建议这样做,为了一个小小的功能增加了系统的复杂度。
372
+
373
+ 最后,再分享两篇我觉得写的还不错的文章:
374
+
375
+ - [ 分布式锁实现原理与最佳实践 - 阿里云开发者] ( https://mp.weixin.qq.com/s/JzCHpIOiFVmBoAko58ZuGw )
376
+ - [ 聊聊分布式锁 - 字节跳动技术团队] ( https://mp.weixin.qq.com/s/-N4x6EkxwAYDGdJhwvmZLw )
369
377
370
378
<!-- @include: @article-footer.snippet.md -->
You can’t perform that action at this time.
0 commit comments