7

redis实现分布式锁踩坑记录-奔跑的河马

 4 years ago
source link: https://blog.51cto.com/13733462/2487512
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
这里主要记录项目中使用基于redis的分布式锁所遇到的问题及解决方案;业务场景我的业务场景是这样的,我们服务有库存模块,而我的服务又是多节点部署,要高峰期会存在库存差异,后面分析问题之后,打算采用redis实现分布式锁(主要的原因是服务已经集成了redis,不需要做额外的配置)问题1.数据库事务超时不要感觉奇怪,分布式锁怎么会导致数据库事务超时呢?我的代码大概是这样的:伪代码@Transactio

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK