当前位置:网站首页>设计电商秒杀系统
设计电商秒杀系统
2022-07-03 20:22:00 【InfoQ】
一、背景
技术
- 技术团队 Java 技术为主
- 已落地微服务
- 目前单机房
- 有 APP 跟微信小程序,要求仅 APP 用户才能参与秒杀
业务
- 在销售商品 <=10 个品类 *20 个商品
- 本次秒杀 2 个商品(1000 个充电宝、10 台 iphone12)
- 正常日活大约 100w 用户
- 目前只有单机房
- 老板需要万无一失
二、业务分析
三、设计的思路
- 做好隔离:包括秒杀服务的隔离、中间件的隔离。单独部署服务集群,防止拖垮其他服务。
- 多层限流:保证到达 DB 层能在可控的流量。
- 尽量缓存:把商品提前预热到缓存,包括库存的数据。
- 高可用设计:包括限流、排队、降级、熔断。

存储架构设计


六、计算架构设计
6.1、负载均衡设计

6.2、缓存设计

七、高可用设计
7.1、限流设计

- 1、请求端的限流:发起请求的时候限流,被限流的请求实际上没有到后端服务器
- 2、接入端的限流:接到业务请求的时候进行限流,避免请求进到实际的业务处理流程
- 3、单个服务自我保护,如果请求太多,可以舍弃新的请求
7.2、排队设计

- 1、排队模块。使用 Kafka 消息队列,将请求以先进先出的方式保存下来,队列大小可以比秒杀商品多一些。
- 2、调度模块。根据秒杀服务处理能力检测,有能力处理,将队列的消息下方到秒杀服务中去。
- 3、其他服务。真正的业务处理模块,如下单、完成交易。
7.3、降级设计

7.4、熔断设计

边栏推荐
- Wargames study notes -- Leviathan
- Global and Chinese market of high temperature Silver sintering paste 2022-2028: Research Report on technology, participants, trends, market size and share
- Test panghu was teaching you how to use the technical code to flirt with girls online on Valentine's Day 520
- TLS environment construction and plaintext analysis
- Analysis of gas fee setting under eip1559
- Reinforcement learning - learning notes 1 | basic concepts
- Qtablewidget control of QT
- PR notes:
- Sparse matrix (triple) creation, transpose, traversal, addition, subtraction, multiplication. C implementation
- Q&A:Transformer, Bert, ELMO, GPT, VIT
猜你喜欢
Haven't expressed the artifact yet? Valentine's Day is coming. Please send her a special gift~
It is discussed that the success of Vit lies not in attention. Shiftvit uses the precision of swing transformer to outperform the speed of RESNET
Change deepin to Alibaba image source
jvm jni 及 pvm pybind11 大批量数据传输及优化
C 10 new feature [caller parameter expression] solves my confusion seven years ago
2.2 integer
2.6 formula calculation
2.5 conversion of different data types (2)
Shortest path problem of graph theory (acwing template)
AcWing 1460. Where am i?
随机推荐
Derivation of decision tree theory
Promethus
Upgrade PIP and install Libraries
It is discussed that the success of Vit lies not in attention. Shiftvit uses the precision of swing transformer to outperform the speed of RESNET
18、 MySQL -- index
19、 MySQL -- SQL statements and queries
About callback function and hook function
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
Make a simple text logo with DW
2.2 integer
Global and Chinese markets of cast iron diaphragm valves 2022-2028: Research Report on technology, participants, trends, market size and share
Detailed and not wordy. Share the win10 tutorial of computer reinstallation system
你真的知道自己多大了吗?
Basic command of IP address configuration ---ip V4
Micro service knowledge sorting - asynchronous communication technology
The simplicity of laravel
强化學習-學習筆記1 | 基礎概念
MDM mass data synchronization test verification
2022 melting welding and thermal cutting examination materials and free melting welding and thermal cutting examination questions
MySQL master-slave synchronization principle