Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于分布式锁对比的一点补充 #209

Closed
a7217107 opened this issue Jan 25, 2021 · 1 comment
Closed

关于分布式锁对比的一点补充 #209

a7217107 opened this issue Jan 25, 2021 · 1 comment

Comments

@a7217107
Copy link

使用 Redis 如何设计分布式锁?使用 Zookeeper 来设计分布式锁可以吗?以上两种分布式锁的实现方式哪种效率比较高?

redis 分布式锁和 zk 分布式锁的对比

基于ZK的锁支持在获取锁失败后等待锁释放的事件,更加灵活。

问题:由于ZK依靠session定期的心跳来维持客户端,如果客户端进入长时间的GC,可能会导致ZK认为客户端宕机而释放锁,让其他的客户端获取锁,但是客户端在GC回复后,会认为自己还持有锁。

@yanglbme
Copy link
Member

@a7217107 谢谢反馈,我补充到文章中

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants