当前位置:网站首页>Role of message queuing
Role of message queuing
2022-06-24 10:15:00 【Ugly and ugly】
The role of message queuing can be summarized as follows : decoupling 、 asynchronous 、 Peak shaving . We use the current popular e-commerce system to illustrate the use of these three functions of message queue .
decoupling
If the upstream system calls the downstream system synchronously , It will greatly reduce the throughput and concurrency of the system , And the system coupling is too high . The function of decoupling is to reduce the system and the system , Or the coupling degree between modules in the system ,, Improve system throughput and concurrency .
The normal order placing process of e-commerce system is actually only to submit orders for users 、 Relationship Logistics , But for its background service , These processes will be handed over to “ Order service ” To complete , This set of actions may be related to operations involving inventory 、 Operation of marketing related functions 、 User points and other operations , And recommended or other operations . Before using message queuing , These related processes and operations are almost synchronized , Only when one step is completed can you continue to the next step , In this case, the coupling between various services or modules is very high , If there is a problem with the service of any module , Then the order placing process will not be completed . When using message queues , This problem can be completely solved . After the order service receives the user's request to submit an order , The task will be handed over to the message queue for processing , That is, the operation of commodity inventory 、 Operation of user points 、 The operation of marketing function and recommendation will be called by the message queue , For users , As long as the order is successful , It means that the process has been completed , Subsequent related operations will be performed without the user's knowledge .

Before accessing the message queue , The order service interacts with each module as shown in the figure above . After accessing the message queue , The order service will hand over the task to the message queue , The message queue is responsible for the interaction with each module . As shown in the figure below :

asynchronous
After order payment , Back office service will deduct inventory 、 Add points 、 Sending messages and so on , And the processing flow is chain , A long link , The response time becomes longer . Import message queue , Basically, each node can handle it asynchronously , This reduces response time .

Peak shaving
Message queues can also be used to cut the peak , For example, seckill system , The usual traffic may be very low , But when it comes to second kill , The second kill moment will frantically request our server ,Redis,MySQL They have different bearing capacity , The underlying system may not be able to handle all the traffic directly . here , After introducing the message queue , We can throw a lot of requests into the message queue , Then take it easy , In this way, the goal of processing a large number of requests is achieved .
This article references from : 20000 words 、 Thirty figures 、 Twenty three questions , Get it done RocketMQ! - Nuggets
边栏推荐
- Phpstrom code formatting settings
- El table Click to add row style
- Leetcode-498: diagonal traversal
- Machine learning perceptron and k-nearest neighbor
- 6.套餐管理业务开发
- Canvas draw picture
- Which of the top ten securities companies has the lowest Commission and is the safest and most reliable? Do you know anything
- 卷妹带你学jdbc---2天冲刺Day1
- 有关二叉树 的基本操作
- Use of vim
猜你喜欢

Programming questions (continuously updated)

1.项目环境搭建

canvas管道动画js特效

6.套餐管理业务开发

Groovy obtains Jenkins credentials through withcredentials

p5.js千纸鹤动画背景js特效

Floating point notation (summarized from cs61c and CMU CSAPP)

Operator details

Jcim | AI based protein structure prediction in drug discovery: impacts and challenges

记录一下MySql update会锁定哪些范围的数据
随机推荐
Arbre binaire partie 1
二叉樹第一部分
p5.js实现的炫酷交互式动画js特效
物联网?快来看 Arduino 上云啦
CVPR 2022 oral | NVIDIA proposes an efficient visual transformer network a-vit with adaptive token. The calculation of unimportant tokens can be stopped in advance
Getting user information for applet learning (getuserprofile and getUserInfo)
如何在一个页面上使用多个KindEditor编辑器并将值传递到服务器端
Get the QR code of wechat applet with parameters - and share the source code of modifying the QR code logo
SSH Remote Password free login
NVIDIA's CVPR 2022 oral is on fire! 2D images become realistic 3D objects in seconds! Here comes the virtual jazz band!
Floating point notation (summarized from cs61c and CMU CSAPP)
1.项目环境搭建
Safety and food security for teachers and students of the trapped Yingxi middle school
Jcim | AI based protein structure prediction in drug discovery: impacts and challenges
Impdp leading schema message ora-31625 exception handling
Why is JSX syntax so popular?
leetCode-1051: 高度检查器
Error reading CSV (TSV) file
MYSQL数据高级
小程序学习之获取用户信息(getUserProfile and getUserInfo)