1. Why do we need MQ?
(1) Peak and fill Valley
Take the order system and settlement system scenario, if the order system calls the billing system through the RPC framework,
The amount of orders generated in the event of a peak sale can be very large, and because the order is generated very quickly,
This will inevitably cause system pressure to the settlement system, the server utilization will be high, but in the peak point of time the order volume is smaller,
The server utilization of the clearing system will be low.
By MQ, the order is stored in the MQ queue, the consumer is pulled by the way, and pull the speed has the consumer to control, then you can control the traffic to stabilize.
Thus, for the settlement system, it has achieved the purpose of peak load shifting. Or the goal of the flow control.
2. MQ Selection?
(1) Scene
Rabmq:focus on Standards (AMQP)
Kafka:focus on Application
(2) Performance
rabmq:20k-/S
kafka:100k-/S
(3) Architecture and Design
Reference:
1. How to use mq-detailed feature scenes-Wang Xindong
2. "Understanding when to use RabbitMQ or Apache Kafka"
RabbitMQ vs Apache Kafka