Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.3k views
in Technique[技术] by (71.8m points)

关于数据库商品库存的架构设计问题

比如像京东这样的网站,商品 A 的库存是 10000 件
问题 1:单机架构会有性能瓶颈,不能支持大量用户同时购买
问题 2:分布式架构 node1, node2 每个都是 5000 件,前端应该展示库存为多少? node1 库存变为 0,node2 库存还有 3000 件,这个时候需要用 rpc 请求减少 node2 的库存吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

可以不用做分布式,做集群就好了,比如一主一从,或一主多从。
为了解决并发问题可以加Redis缓存,将购买流程拉长等


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...