Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the usage scenarios of message middleware

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail the usage scenarios of the message middleware, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

The usage scenarios of message middleware are: 1, asynchronous processing; 2, application decoupling; 3, traffic peaking; 4, log processing; 5, pure message communication.

The usage scenarios of message middleware are:

Why use message Middleware

Solve the message transmission between distributed systems.

E-commerce scenario: users place orders to reduce inventory, call the logistics system, service after system expansion and business split. System interaction, y generally uses RPC (remote procedure call). If the system is expanded to have dozens of interfaces, message middleware can solve the problem.

What are the usage scenarios of message middleware

I. Asynchronous processing

User registration (50ms), and send email (50ms) and SMS (50ms)

Serial: (150ms) user Registration-"send email -" send SMS

Parallel (100ms): user registration-"send email"

A), |-"send SMS messages

Message Middleware (56ms):

User registration (50ms)-"(6ms) message middleware"-send mail

"- send text messages

Description: a user registration process that includes the following services:

1. Registration processing and writing to database,

2. Send SMS messages with successful registration.

3. Send email messages with successful registration.

If we use the old method, we will register to send a text message and then send an email. Too low

Generally used is: after the registration is successful, the use of two threads to send mail, send text messages.

If you use message middleware: save the two threads to create these things, send the message directly to the message middleware, and then let the mail service and SMS service go to the message middleware to get the message by themselves. then get the message and then do the corresponding business operation. It's that convenient.

2. Decoupling of applications

A), order system-inventory system (strong coupling)

B), message middleware: order system-"message middleware"-inventory system (decoupling)

Description: the user buys an order, and the order is closed-"call inventory system-1murmuri -" back to the order system, which is a normal business at this time. There is also abnormal business, that is, after the user's order is completed, the order system does not use inventory system-1 to operate, but calls message middleware to write an order information. The inventory system goes to the message middleware to get it, and then updates the inventory, which can reduce the fast attribute pursued by Internet-based applications. In fact, the operation of the inventory system to read the inventory between orders is also very fast, so message middleware is also a good direction for decoupling.

Third, peak cutting of flow rate

A), user request-"second kill application"

B), the front end of the application joins the message queue

C), user request-"message queue"-second kill application

Description: for example, the system holds flash sale activity, a popular commodity. Traffic swarmed to 100 items, 100000 people crowded in what to do, 100000 seconds to kill the operation, put into the message queue. The second kill application processes 100 of the 100000 requests in the message queue, and the rest calls back, and the notification fails. The peak traffic is controlled in the message queue, and the second kill application will not be killed instantly.

IV. Log processing

A. Error log-"message queue"-log processing

B), user behavior log-"message queuing (kafka)"-storage or streaming of log

Description: log processing may be the strength of kafka at any time, big data's log processing must be it, I have not used it, only know that it is very powerful. Very powerful.

5. Pure message communication

This is the end of the usage scenarios of message middleware. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report