62

从构建分布式秒杀系统聊聊Lock锁使用中的坑-小柒2012

 5 years ago
source link: http://blog.51cto.com/itstyle/2124865
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.
前言在单体架构的秒杀活动中,为了减轻DB层的压力,这里我们采用了Lock锁来实现秒杀用户排队抢购。然而很不幸的是尽管使用了锁,但是测试过程中仍然会超卖,执行了N多次发现依然有问题。输出一下代码吧,可能大家看的比较真切:@Service("seckillService")publicclassSeckillServiceImplimplementsISeckillService{/***思考:为什么

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK