5 RabbitMQ three major advantages

Three advantages of RabbitMQ

1. Decoupling:
If MQ is not used, when a system in a distributed system provides data to multiple subsystems, when the downstream subsystem changes, Publisher also needs to make corresponding changes. The system coupling is high.
After using RabbitMQ, we only need to let the Publisher send the message to the middleware, and we don't need to care about who receives the message.
2. Asynchronous:
Take the system multi-level call as an example:
successful order (order system) – send SMS (SMS system) – xxx (downstream subsystem
) After the order is successful, the message is stored in RabbitMQ, allowing the SMS system and downstream subsystems to execute asynchronously. Reduce overall system runtime.
3. Cut peaks and fill valleys:
Shaving peaks and filling valleys

If requests increase instantly, 5000 requests come, and system A cannot process 5000 requests in one second, we can store these 5000 requests in MQ, and then take out 1000 messages from MQ per second for consumption.

The principle of peak shaving and valley filling:
In fact, it is to use the consumer's current limiting mechanism:
first confirm that the ack mechanism is manual sign-in. (Sleep for 1s before manually signing in)
Secondly, the listener-container configuration attribute perfetch=1000 means that 1000 messages are consumed at a time.

Guess you like

Origin blog.csdn.net/weixin_68930048/article/details/128258325