1. The application scenario of message queue
Reference website:
four applications message queue scenarios
[消息队列设计思路](https://blog.csdn.net/zl1zl2zl3/article/details/51966826)
(1) Asynchronous Processing
User registration, can simultaneously send messages and text messages into the message queue functions implemented. You can improve the user response time, improve the system throughput.
(2) Application of Decoupling
Single user and inventory debits used in the message, you can prevent the inventory system problems, leading to failure of a single user.
(3) flow clipping
Spike activity in a certain moment due to the large, it may be added in the middle of the client and the service processing message queue, the number of restrictions, too many users request discarded. This prevents traffic surge causes the server to hang.
(4) log processing
The client log collection, is responsible for log data collection, timed written by Kafka write queue
Kafka message queue, the log data is responsible for receiving, storing and forwarding
Log Processing Application: Subscription and consumption log data kafka queue
ELK stack log analysis. (Elasticsearch, Logstash, Kafka used to live)
(5) Communication Message
Point to Point Communications
chatroom
2. The message retransmission compensation Solutions
Reference website: RocketMQ resolution message ordered and repetitive thoughts
3. The power of the message, etc. Solutions
How do the MQ message idempotent
MQ messaging reachability + Idempotence delay architecture + design
4. Message of accumulation Solutions
The method of processing a message it is deposited kept down. But this memory can be made in many ways. For example, stored in memory, stored in a distributed KV years, stored on disk, stored in the database, and so on. But it boils down, there are persistent and non-persistent two kinds.
Message persistence message form to ensure a greater degree of reliability (e.g., power-off force majeure), theoretically can carry a greater extent and bulk (much larger than the memory space of the external memory).
But not every message will require persistent storage. Many requirements for message delivery is greater than the performance requirements of reliability, and a great number (such as log). At this time, the message does not fall directly to the temporary memory, several attempts failover, the final delivery is also not a bad idea to go out.
The market generally two forms of message queues are supported. Of course, the specific scene also combined with the company's specific business point of view.
The idea to ensure orderly message
6. How to implement your own message queue
Message Queuing Design Essentials
Distributed message queue implementation Summary
Original: https://blog.csdn.net/maihilton/article/details/80037824