当前位置:网站首页>After using MQ message oriented middleware, I began to regret
After using MQ message oriented middleware, I began to regret
2022-07-26 00:12:00 【Notes on Shi Shan's architecture】
One Previous review
Last article 《 Why use MQ Message middleware ? These questions must be taken down !》, I told you about the role of message oriented middleware in introducing system architecture , What problems are mainly solved .
The common practice scenario is :
- Decoupling of complex systems
- Asynchronous call of complex link
- Peak clipping of instantaneous peak
Two The official start of the
This article tells you about , If you introduce message oriented middleware into the system architecture , What are the disadvantages ?
1 Reduced system availability
First, the overall availability of your system will definitely decrease , Let me give you an example , Let's take the previous picture to illustrate .
For example, in a core link , System A -> System B -> System C, And then the system C It's through MQ Call the system asynchronously D Of .

It's looks good , You use this MQ The asynchronous method solves the problem of poor performance of the core link .
But have you considered another question , It's the one you rely on MQ What if the middleware suddenly hangs ? This is really not wishful thinking ,MQ、Redis、MySQL These components may hang .
Once your MQ Hang up , It leads to the interruption of the core business process of your system . Originally, if you didn't introduce MQ middleware , That is actually the call between some systems , But now you have introduced MQ, It will cause you to rely on one more . Once you have one more dependency , It will reduce your availability .
therefore , Once introduced MQ middleware , You have to think about this MQ How is it deployed , How to ensure high availability .
Even in complex high availability scenarios , You should also consider if MQ Once you hang up , Does your system have a backup technical solution , It can ensure the continuous operation of the system .
I wrote an article before , It's about MQ High availability guarantee scheme after hanging up .
If you are interested , You can refer to it :
- 《 use RocketMQ Realize the final consistency scheme of reliable messages ,yyds!》
Through this article , Let's take a look at what we encounter in various scenes MQ High availability degradation scheme adopted for fault .
2 The stability of the system is reduced
The same picture above , Let's have a look again .

I wonder if you have found a problem , This link is in addition to MQ Besides the possible hidden danger of middleware failure , There may be other technical problems .
for instance , Inexplicably , System C Sent a message to MQ, As a result, the message was due to network failure and other problems , It's lost . This causes the system to D I didn't receive that message .
This is terrible , This will cause the system to D I didn't finish my task , At this time, the whole system may have business disorder , Data loss , serious bug, Poor user experience and other problems .
This is just one of them , In case the system C to MQ Send a message , Accidentally, I took a draught and repeatedly sent an identical , Cause the message to repeat , What to do at this time ?
May cause the system to D Insert a piece of data twice at once , Causing data errors , Generation of dirty data , Finally, it will lead to various problems .
Or if the system D Suddenly down for a few hours , Leads to inability to consume messages , As a result, a large number of messages are MQ There is a long backlog in middleware , What to do at this time ?
Even if the system D To restore the , We also need to process consumption data slowly .
So that's the introduction of MQ The second big problem of middleware , The stability of the system may decrease , Faults will increase , All kinds of messy problems can arise .
And once a problem arises , It will cause problems in the whole system . In order to solve all kinds of MQ Technical problems caused , Take a lot of technical solutions .
About this , We'll talk about it later with a special article MQ Solutions to these problems of middleware , Include :
- Highly reliable message delivery (0 The loss of )
- Message idempotent transmission ( Never repeat )
- Online fault handling of millions of messages backlog
3 Distributed consistency issues
Introduce message middleware , There is also the problem of distributed consistency .
for instance , For example, the system C Now you have successfully processed your local database , Then sent a message to MQ, System D It is indeed consumption .
But unfortunately , System D Failed to operate your local database , What should I do at this time ?
System C succeed , System D failed , It will cause the overall data of the system to be inconsistent .
So at this time, we need to use the distributed transaction scheme of reliable message final consistency to ensure .
About this , You can refer to a previous article :
《 use RocketMQ Realize the final consistency scheme of reliable messages ,yyds!》
We have described in detail the scenario of asynchronous calls between systems , How to adopt distributed transaction scheme to ensure its data consistency .
3、 ... and summary
Last , Let's make a simple summary .
Answer this question well in the interview , First of all, be familiar with MQ The advantages and disadvantages of this technology . Understand what problems he was introduced into the system to solve , But what problems will he bring .
Besides , For the introduction of MQ in the future , Is there any plan design for the problems that may be caused by himself , To ensure high availability of your system 、 Highly reliable operation , Ensure data consistency . This also makes corresponding preparations .
边栏推荐
- Prometheus 运维工具 Promtool (二) Query 功能
- Sort fake contacts
- C language actual combat guessing game
- 初阶C语言 - 分支语句(if、switch)
- 如何用120行代码,实现一个交互完整的拖拽上传组件?
- [one library] mapbox GL! A map engine out of the box
- Appium中控件元素封装类梳理
- Yes, UDP protocol can also be used to request DNS server
- 通货膨胀之下,后市如何操作?2021-05-14
- 栈与队列——239. 滑动窗口最大值
猜你喜欢
随机推荐
Getaverse, a distant bridge to Web3
STM32 timer
如何用120行代码,实现一个交互完整的拖拽上传组件?
YoloV4-tiny网络结构
Sequence traversal II of leetcode107 binary tree
The bull market will continue. Take your money 2021-05-08
Security document archiving software
BGR and RGB convert each other
STM32 serial port
NVIDIA可编程推理加速器TensorRT学习笔记(三)——加速推理
LeetCode高频题66. 加一,给你一个数组表示数字,则加1返回结果
BOM browser object model
Annotation @autowired source code analysis
Redirection and request forwarding
07_ue4进阶_发射火球扣mp值和攻击扣血机制
Binary tree 101. Symmetric binary tree
Binary tree -- 111. Minimum depth of binary tree
"Demons dance", is the bull market over? 2021-05-13
用了MQ消息中间件后,我开始后悔了...
没错,请求DNS服务器还可以使用UDP协议









