Article directory
What is MQ
MQ (Message Queue) message queue is a data structure of "first in, first out" in the basic data structure. It refers to putting the data (message) to be transmitted in the queue, and using the queue mechanism to realize message delivery-the producer generates a message and puts the message into the queue, and then the consumer processes it. Consumers can go to the specified queue to pull messages, or subscribe to the corresponding queue, and the MQ server will push messages to it.
Advantages of MQ
1. Decoupling
A business requires multiple modules to be implemented together, or a message needs to be processed by multiple systems. It only needs to send an MQ after the main business is completed, and other modules consume MQ messages to realize the business and reduce the coupling between modules.
2. Asynchronous
After the execution of the main business, the subordinate business is executed asynchronously through MQ, which reduces the response time of the business and improves the user experience.
3. Flow peak clipping
In the case of high concurrency, the business is processed asynchronously, providing peak business processing capabilities and avoiding system paralysis.
Disadvantages of MQ
1. Reduced usability
The more dependent services are, the easier it is for the service to hang up. The situation of MQ paralysis needs to be considered.
2. Increased complexity
It is necessary to consider aspects such as message loss, repeated consumption of messages, and the order of message delivery.
3. Consistency issues
Consistency handling of main business and subordinate business.
Types of MQ
ActiveMQ,RabbitMQ,RocketMQ,Kafka
Comparison of the differences between various MQs
compare content | ActiveMQ | RabbitMQ | RocketMQ | Kafka |
---|---|---|---|---|
Performance (stand-alone) | 6000 | 12,000 | 100,000 | 1000000 |
language support | mainstream language | mainstream language | Java | mainstream language |
Persistence | support (degraded performance) | support (degraded performance) | support | support |
advantage | timeliness ms level | High availability, easy to use management interface | Message 0 is missing, model is simple | Distributed, excellent performance, high throughput |
shortcoming | It cannot be applied on a large scale, and the official maintenance is less | Business version fee | Simple model, good performance and few supported languages | There are requirements for bandwidth, and the community update is slow |
Articles in the same series
Principle part
Introduction to RabbitMQ
Four core concepts and working principles of RabbitMQ
Operating part
Install RabbitMq on Windows version of Docker
Maven integrates RabbitMQ to realize production and consumption messages SpringBoot integrates
RabbitMQ to realize production and
consumption messages