Overview of distributed messaging middleware

Currently commonly used message middleware are RabbitMQ, RocketMQ, Kafka, etc. This blog does not involve any message middleware, but simply introduces some concepts and solutions of message middleware. The essence of message middleware is the communication between two processes. For example, HTTP, RPC, and Webservice can communicate between processes, so why do we need this component of message middleware?

Let’s consider a scenario. If there is a trading system, an SMS notification needs to be sent after the transaction is successful. If the transaction takes 100 milliseconds, it will take 200 milliseconds to send the text message. If HTTP is used, the entire transaction process will take 300 milliseconds. It's not that strong. At this time, we can put the SMS in the message queue and send it. This is a typical scenario of messaging middleware. Compared with the real-time communication of HTTP and RPC, message communication reduces the coupling degree between systems and can improve the processing capacity between systems.

Below we will introduce several common scenarios of message middleware, including subscription publishing, peak cutting and valley filling, asynchronous decoupling, sequential sending and receiving, and log collection.

Peak-cutting and valley-filling: Large-scale activities such as spikes and red envelopes will bring relatively high traffic peaks, which are likely to cause system overload or even crash, or limit the number of requests that cause a large number of requests to fail and affect user experience. Message middleware can Realize the service of peak shaving and valley filling to solve these problems.

Asynchronous decoupling: The general transaction system is the core system, and each transaction order data will attract the attention of dozens or hundreds of downstream businesses, such as integration, calculation and analysis, etc., message middleware can achieve asynchronous decoupling to ensure the continuity of core business

Sequential sending and receiving: There are many uses of sequential messages. For example, order creation, payment, refunds, etc. must be processed in order. Many messages can gradually guarantee the sequence of messages, that is, comply with the FIFO principle.

Distributed consistency: Distributed and microservices must ensure transaction consistency. The use of message middleware can decouple applications and ensure transaction consistency.

There are many uses of message middleware. Different message middleware have different characteristics, but in general, the most basic components include producer, message, and consumer. The producer is used to produce messages and will send the message to the message middleware server, and the consumer will actively pull the message that needs the message or push the message subscribed by the consumer to the consumer. The following is the message delivery process of message middleware:

Here we do not specifically introduce the producer. Consumers and messages, because different message middleware will have different implementations. We will introduce the use of RocketMQ, RabbitMQ and Kafka in detail later. The following is a comparison of commonly used middleware:

 

Guess you like

Origin blog.csdn.net/wk19920726/article/details/108596696