当前位置:网站首页>The wonderful relationship between message queue and express cabinet
The wonderful relationship between message queue and express cabinet
2022-07-07 23:00:00 【InfoQ】
One 、 The message queue is a delivery cabinet
- Message queues are compared to express cabinets: Many manufacturers produce express cabinets , Such as : Fengchao (apache kafka), Express mail (alibaba RocketMQ), Nearest neighbor treasure (ActiveMQ) wait , Anyway, these are the only ones commonly used . The express cabinet is responsible for temporary storage of mail , Message queue is responsible for temporarily saving message data .
- Couriers are compared to message producers: The courier is responsible for delivering mail to the express cabinet , The producer is responsible for delivering messages to the message queue . It's the same as different !
- Consumers are compared to news consumers: Maybe this example is too appropriate , So much so that this sentence is nonsense . Nonsense still needs to be said , Consumers in life pick up e-mail , Consumers in the program get message data .

Two 、 Express cabinet ( Message queue ) Benefits
- Asynchronous decoupling : With the express cabinet , Consumers don't have to wait for the courier , User experience enhancements . Consumers and producers ( Courier ) Decoupling between , Not because of the other party's operation behavior , Procedures that affect your independence . Users don't have to wait and receive events. Blocking takes time .
- Traffic peak clipping : Let's assume an extreme case , You bought... Through various channels 1000 This book , Suddenly, I'll call you intensively one hour . You certainly don't have the ability to charge for an hour 1000 The ability to send an email , So you ask the courier to put the mail in the express cabinet . So you can handle it according to your ability , Pick up the mail according to your own schedule . Similarly, our consumer programs are facing multiple users 、 In the case of highly concurrent requests , Putting the data into the message queue for saving can cut the peak of traffic data , Data consumption shall be carried out according to the processing capacity and resources of the program .
- Buffer batch : Batch delivery by producers , Shuang ! Consumers get multiple emails at one time , Shuang !
3、 ... and 、 Disadvantages of introducing express cabinet
- Introduce complexity . without doubt , Express cabinet ( Message queue ) This thing is extra , It doesn't exist in the original collection process . So I need a place to put it , Fire protection is also needed 、 Anti theft and moisture-proof , It needs to be maintained . The same is true for Message Queuing Middleware , You need to install it in the server area , And maintain it .
- It will cause temporary data inconsistency . If there is no express cabinet , When you receive an email, you really receive . But after using the express cabinet , You received " The message that the mail is put into the express cabinet ", But there will be a certain delay when you really get the email . Of course, you will eventually get the mail , choice " Message queue " Express cabinet , Is to endure temporary inconsistencies , Accept " Final consistency ".
- Of course, in extreme cases , The express cabinet is broken , You have to inevitably accept " Mail may be lost " Fact , For communities with high security coefficient, this will hardly happen .
边栏推荐
- 0-5VAC转4-20mA交流电流隔离变送器/转换模块
- Cause analysis and solution of too laggy page of [test interview questions]
- The PHP source code of the new website + remove authorization / support burning goose instead of pumping
- Yarn开启ACL用户认证之后无法查看Yarn历史任务日志解决办法
- Select sort (illustration +c code)
- 每日一题——PAT乙级1002题
- Personal statement of testers from Shuangfei large factory: is education important for testers?
- Leetcode interview question 02.07 Linked list intersection [double pointer]
- 6-3 find the table length of the linked table
- Unity 动态合并网格纹理
猜你喜欢

Line test - graphic reasoning - 1 - Chinese character class

How to judge whether the input content is "number"

PHP method of obtaining image information

Unity FAQ (I) lack of references

“拧巴”的早教行业:万亿市场,难出巨头

Understand the session, cookie and token at one time, and the interview questions are all finalized

Sword finger offer 28 Symmetric binary tree

行测-图形推理-4-字母类

知识点滴 - PCB制造工艺流程

ASP. Net core introduction V
随机推荐
Qt Graphicsview图形视图使用总结附流程图开发案例雏形
How pyGame rotates pictures
筑起云端 “免疫”屏障,让你的数据有备无患
双非大厂测试员亲述:对测试员来说,学历重要吗?
De la famille debezium: SET ROLE statements supportant mysql8
消息队列与快递柜之间妙不可言的关系
Leetcode1984. Minimum difference in student scores
消费品企业敏捷创新转型案例
Common verification rules of form components -2 (continuously updating ~)
面试百问:如何测试App性能?
7-51 combination of two ordered linked list sequences
Interview questions: how to test app performance?
肠道里的微生物和皮肤上的一样吗?
微服务架构开源框架详情介绍
Nx10.0 installation tutorial
Yarn cannot view the historical task log of yarn after enabling ACL user authentication. Solution
Leetcode interview question 02.07 Linked list intersection [double pointer]
Loki, the "open source star picking program", realizes the efficient management of harbor logs
GBU1510-ASEMI电源专用15A整流桥GBU1510
Sword finger offer 63 Maximum profit of stock