[] Message queue message queue selection problem

Previous We discussed the shortcomings of why the use of message queues, and message queues. Today we explore what we in the end what kind of message queue to use. Not only the best technology most appropriate technology, not to pursue the best performance while ignoring the availability, always remember that " premature optimization is the original sin ."

 

Let me talk about the conclusion:

  • Small and medium companies, technical strength is more general, the technical challenges are not particularly high, with RabbitMQ is a good choice; large companies, infrastructure, strong R & D strength, with RocketMQ is a good choice

  • If it is calculated in real time a large data field, collecting logs and other scenes, with Kafka is the industry standard

To date, the industry is now popular middleware message queues are:

  • Redis

  • ActiveMQ

  • RabbitMQ

  • RocketMQ

  • Kafka

 

(1) Redis

In our minds, Redis is a key-value cache middleware, rather than a message queue middleware. But in fact it supports itself MQ function, it can use as a lightweight queue service to use. For the team and the operations team RabbitMQ and Redis, and implementing a million times, once every 100,000 recorded execution time. Test data is divided into data 128Bytes, 512Bytes, 1K 10K and four different sizes.

Experiments show that: when the team, when performance data is relatively small Redis is higher than RabbitMQ, and if the data size exceeds 10K, Redis is slow can not stand; when the team, regardless of the data size, Redis have shown a very good performance , but the team performance RabbitMQ is much lower than Redis.

But in practical application, we consider the messaging middleware in general is not the time to consider Redis. There are two main reasons, one is the data size exceeds 10K is slow Another problem is that Redis create the impression that do cache. Based on the above these two reasons, Redis is more suitable for applications where small size, business simple message queue scene. If the business complex, large-scale business, Redis under normal circumstances would be excluded.

(2)ActiveMQ

ActiveMQ is a subproject of Apache. Similar ZeroMQ, it can queue as agent and peer to peer technology. At the same time like RabbitMQ, a small amount of code it can efficiently implement advanced application scenarios.

(3)RabbitMQ

RabbitMQ is written in Erlang using an open source message queue itself supports many protocols: AMQP, XMPP, SMTP, STOMP, because of this, it is very heavyweight, is more suitable for the development of enterprise-class. While achieving Broker architecture, which means that the message is queued in the first queue at the center sent to the client. Routing, load balancing or data persistence have very good support.

(4)Kafka

Kafka is a subproject of the Apache, is a high-performance cross-language distributed publish / subscribe message queue system. It has the following characteristics: rapid persistence, the message may be persistent in O (1) overhead; high throughput, on a common server throughput rate can be achieved either 10W / s; a fully distributed system, Broker, Producer, Consumer automatic support for distributed are native, automatic load balancing; supports Hadoop data loaded in parallel, the same as for off-line analysis of log data and Hadoop system, the restriction but requires real-time processing, this is a viable solution Program.

(5)RocketMQ

RocketMQ is an open source project Alibaba, it has been incorporated into the Apache Foundation. It is developed on the basis of Kafka on, the cause is with the development of Alibaba's business, they discovered Kafka support for specific business scenarios imperfect, so only the birth of RocketMQ.

与 Kafka 比起来,RocketMQ 很多方面都极其相似。唯一的不同是 RocketMQ 对于业务特性的支持更完善,所以更适用于业务场景。

从上面的表格我们可以看出几个简单的结论:

  • 无论是在单机吞吐量还是可用性方面,ActiveMQ和RabbitMQ都差不多,而RocketMQ和Kafka差不多。

  • 在功能特性方面,ActiveMQ、RabbitMQ、RocketMQ功能比较完善。Kafka功能性较弱。

Guess you like

Origin www.cnblogs.com/hwtblog/p/12078382.html