Why you want to use in the project message queue
Message Queuing using three main scenarios:
Decoupling, asynchronous, clipping
1, decoupling
As shown above, there may be a certain critical data generating system, which was necessary for all systems to provide data, cause the system A to be provided with a coupling system data, to expand the system, the system requirements other modifications will cause the system to produce a modified A.
2, asynchronous
If a user clicks, requires a series of reactions between several systems, each system at the same time there are some willing to time-consuming, you can use to send commands mq different system for asynchronous operation.
3, clipping
If there is a major peak of users, for example, there are a lot of requests to access the database (mysql 2000 requests per second), will exceed stuck, we use MQ as acts like a buffer, in MQ taken in peak large number of requests backlog, according to its own processor, the maximum processing capacity to take the amount of requests, etc. after the request of then consume it off.
What are the disadvantages message queue
1, the availability of the system is reduced: Many services rely on MQ, MQ fault once, the system crashes.
2, the system becomes complicated, consider the sequence increases: sending repeated messages, and more, out of order, lost.
3. consistency problem: A system to send BCD, only succeed before returning successful results BC success, but D failed, but the result is a successful return to the page.
What are the similarities and differences of each MQ and application scenarios
ActiveMQ
The earliest we all use ActiveMQ, but now we do not much use, no proven large-scale throughput scene, the community is not very active, single throughput, 10,000, and Kafka RocketMQ throughput than an order of magnitude lower in response to ms level, there is a lower probability of data loss.
RabbitMQ
Stand-alone ten thousand throughput, throughput and Kafka lower than RocketMQ an order of magnitude, but is suitable for small and medium enterprises, because that comes with a friendly interface monitoring and maintenance, the community is relatively active, almost all released several versions of the month points, in some domestic Internet companies in recent years with rabbitmq also some more, but the problem is obvious, RabbitMQ does throughput will be lower, because he did realize mechanism is relatively heavy, but very few people will be language in the country .
RocketMQ
Stand-alone throughput 100,000, RocketMQ also can support one kind MQ high throughput, topic can reach hundreds, thousands of levels, throughput will decrease to a lesser extent, this is RocketMQ a big advantage, at the same under the machine can support a large number of topic, very high availability, distributed architecture, the large-scale application through Ali, Ali has a brand to protect, as much as ten billion daily processing on the message, you can do a large-scale throughput, performance is also very good, distributed expansion is also very convenient, the source code is JAVA.
Kafka
Stand-alone throughput 100,000 level, which is kafka biggest advantage is the high throughput. General classes of systems with large data for real-time calculation data, log collection and other scenes. topic from tens to hundreds of times, throughput will fall significantly.
So in the same machine, kafka try to ensure that the number of topic not too much. If you want to support large-scale topic, need to add more machine resources, availability is very high, kafka is distributed, more than one copy of the data, a small number of machine downtime, no data is lost, does not result in unavailable.