当前位置:网站首页>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 .
边栏推荐
- STM32 pit encountered when using timer to do delay function
- 滑动窗口_
- 12.神经网络模型
- Prometheus operation and maintenance tool promtool (II) query function
- @The underlying principle of Autowired annotation
- LDP相关知识
- Binary tree -- 700. Search in binary search tree
- NVIDIA programmable reasoning accelerator tensorrt learning notes (III) -- Accelerating reasoning
- MySQL——数据库日志
- How does the server build a virtual host?
猜你喜欢

J9数字论:什么是DAO模式?DAO发展过程的阻碍

Binary tree - 112. Path sum

What does it mean that the web server stops responding?

复盘:推荐系统—— 负采样策略

Under inflation, how to operate in the future? 2021-05-14

Appium中控件元素封装类梳理

SQLZOO——Nobel Quiz

letfaw

URL address mapping configuration
34-SparkSQL自定义函数的使用、SparkStreaming的架构及计算流程、DStream转换操作、SparkStreaming对接kafka和offset的处理
随机推荐
栈与队列——239. 滑动窗口最大值
Recent impressions about bull market and defi 2021-05-17
VMware ESXI7.0版本的安装与配置
How long can this bull market last Answers to questions 2021-05-11
Elementary C language - branch statements (if, switch)
初阶C语言 - 分支语句(if、switch)
二叉树——530.二叉搜索树的最小绝对差
Leetcode107-二叉树的层序遍历II详解
Iterator pattern of behavioral pattern
网站服务器停止响应是什么意思?
J9数字论:什么是DAO模式?DAO发展过程的阻碍
Getaverse, a distant bridge to Web3
Thymeleaf view integration
Backtracking - 17. Letter combinations of phone numbers
Js理解之路:写一个比较完美的组合继承(ES5)
LDP相关知识
安全文档归档软件
没错,请求DNS服务器还可以使用UDP协议
用了MQ消息中间件后,我开始后悔了...
服务器如何搭建虚拟主机?