ActiveMQ, Qpid, HornetQ and RabbitMQ in Comparison

 

国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html
内部邀请码:C8E245J (不写邀请码,没有现金送)
国内私募机构九鼎控股打造,九鼎投资是在全国股份转让系统挂牌的公众公司,股票代码为430719,为“中国PE第一股”,市值超1000亿元。 

 

 

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

 

 

http://www.predic8.com/activemq-hornetq-rabbitmq-apollo-qpid-comparison.htm

By: Thomas Bayer
Date: 04/11/2013

 

Newer architectures and the standardized AMQP protocol have led to a flood of message brokers. All brokers take claim to be fast, robust and reliable. But what really distinguish the broker? How do I choose the right broker? Should we continue to use established brokers such as the ActiveMQ or try a more modern one? This article attempts to answer these questions and help the reader in selecting a suitable broker.

The broker described in this article needed to:

  • be available under an open source license
  • allow access from Java
  • offer Quality of Service features such as guaranteed delivery and persistence

In the next sections the broker will be presented with their specialties. Then we handle criteria such as persistence, supported platforms, performance and distribution. The description starts with the established ActiveMQ broker.

 

Apache ActiveMQ

Apache ActiveMQ has the largest number of installations of all open source message broker with the largest distribution. ActiveMQ implements the Java Message Service specification and offers numerous features such as support for the Enterprise Integration Patterns, for Spring Framework and for transactions.

For persistence of messages, different stores are used. The file-based database Kaha offers very good performance because it runs at Java VM of the broker and requires very few resources and has optimized for messages. has become popular too in enterprise environments. But the use of a relational database such as IBM's DB/2 or Oracle database. Using a JDBC store together with a relational database is associated with losing speed, but brings advantages for the operation: the database for persistence of messages can be incorporated into the operating of a data center and the existing mechanism can be used for the backup. It does not always make sense to create a backup for a message store.

A highlight at ActiveMQ is the numerous possibilities of clustering and distribution. In order to keep the operations going in case of failure of a broker ActiveMQ can be be operated in aMaster/Slave configuration. Further, several brokers can be connected to a Network of Brokers. In a Network of Brokers queues and topics (publish / subscribe) are virtual, i.e. a queue is available on all nodes and the routing takes place automatically.

Figure 1 outlines a virtual broker which could be realized with distributed ActiveMQ installations.

Figure 1: Virtual Broker with globally distributed nodes

ActiveMQ is used as bus infrastructure in some Enterprise Service Bus products such as ServiceMix and Mule ESB. There are many other projects that use ActiveMQ for transporting messages. Apache Geronimo and Tomee, the Java Enterprise Edition of the Tomcat Web container, are using ActiveMQ as JMS implementation.

The Fuse MQ Enterprise Broker by Progress Software is based on Apache ActiveMQ broker. Bugfix versions of Fuse are released more frequently as the versions of Apache ActiveMQ.

Since its inception in 2004, the ActiveMQ broker has matured and become widespread. Childhood diseases such as memory leaks have been eliminated long ago. For most tasks ActiveMQ messaging is reliable, high-performance and easy on resources.

ActiveMQ is still a very good choice for Enterprise Messaging. But ActiveMQ has gotten some competition, which is arriving with newer architectures, better performance, and with the support of standardized protocols in the area of the space deer.

Apache Apollo

Apache ActiveMQ Apollo gets competition from its own company. Apollo is a recent development based on the experience of the ActiveMQ project.

In order to be faster, more robust and easier to maintain than ActiveMQ, a completely new architecture was introduced. That architecture is based on Scala programming language, which supports well the development of concurrent systems. The threading of the Apollo broker differs fundamentally from that of the ActiveMQ. All tasks are performed asynchronously and non-blocking which contributes to increased performance and stability. This means that the skills of multi-core processors are better used.

For Apollo, there are two storages for persistent messages. On the one hand on the NoSQL database LevelDB by Google and on the other hand via the Java Edition of the Berkeley DB.

Through the HTML5 WebSocket Connector, a messaging client can be integrated directly into a web page. The following listing shows how to use JavaScript and the Apollo stomp.js library to access a broker from a web page. When connecting, a callback function is registered which displays the contents of a receiving message in a dialog.


1

2

3

4

5

6

7

var client = Stomp.client("ws://apollo.predic8.com:61623");

 

client.connect("admin", "pwd", function(frame) {

   client.subscribe("/topic/like", function(msg) {

      alert(msg.body);

   });

});

Listing 1: Access to the Apollo broker with STOMP and JavaScript

Sending messages from within the browser can be done with following JavaScript one-liner:


1

client.send("/topic/like", {}, inhalt);

Although Apollo is written in Scala, the broker can be used safely in a Java environment. The fact that Apollo is realized with Scala can only be seen because the distribution also contains some Scala libraries among many Java libraries.

 

For the administration Apollo offers a simple web console as the following screenshot shows:

Figure 2: Admin console of the Apollo Broker

If you edit the file extension of the URL from .html to .json you'll get a JSON representation rather than a Web page.

Figure 3: Apollo console as JSON representation

By using REST and JSON you can also achieve write access to the Apollo Web application, for example to create a new queue. Figure 4 shows a screenshot with a visualization of the Apollo REST API. The visualization is integrated in Apollo and realized by the Swagger tool. The description with Swagger is a specification and a framework for the description of REST APIs.

Figure 4: REST API Description with Swagger

There is no client library for Apollo itself. Therefore other clients can be used for the protocols supported by Apollo: MQTT, OpenWire and STOMP.

FFMQ

The Full-Java, native JMS, message Queuer is a lightweight JMS implementation. The whole server is smaller than 600 KB but there are a number of restrictions regarding JMS conformity or transactions. If you can dispense with advanced JMS functionality such as Message Groupsgets a simple, fast and straightforward message broker with FFMQ.

HornetQ

For a long time the basis code of HornetQ was known under the name of JBoss Messaging 2.0until it was a further developed in separate project under the name of HornetQ. HornetQ can be used  independently of the JBoss Application Server. Since version 6 HornetQ is the preconfigured message broker for JMS of the JBoss server.

HornetQ is configured as Enterprise Message Broker. It has lots of features and lots of settings and is a complete implementation of the Java Message Service specification.

The User Manual has got 334 pages and therefore it is the most extensive of the listed Message Broker. The very detailed documentation contains the concepts of the architecture through to XA transactions and clustering.

HornetQ contains no stand-alone console for administration. HornetQ can be managed over the console of the JBoss Application Server. For example you can create queues or read statistics using JMX and MBeans. Since I would like to use the HornetQ in the standalone version a special bracket is on my wish list.

HornetQ has its strengths when used as Enterprise Broker and as JMS implementation. The integration into JBoss will certainly also help to its spread. This implies a certain degree of complexity. So there are more suitable broker if you need just easier configurations. For Enterprise applications HornetQ definitely has a sharp sting.

JBoss Messaging

The development of JBoss Messaging is set. New features will be implemented only in the follow-up project HornetQ. For a while there will be further support and bug fixes.

OpenJMS

OpenJMS was the open source JMS implementation from Sun Microsystems. In recent years, I could not see much activity around OpenJMS. It seems that this project is not especially alive.

Apache Qpid

Besides ActiveMQ and Apollo there is another Apache Message Broker, Apache Qpid. The aim of the Qpid project is the 100 percent compatibility with the Advanced Message Queuing Protocol Standard.

Qpid broker is available for C++ and Java. This article describes the features of the Java version. For Java clients there is a JMS API for Qpid. For C++, Python and Microsoft's .NET there is the Qpid Messaging API.

For the persistence of the messages the relational Apache Derby database and the Oracle Berkeley DB are supported.

Based on Apache Qpid Red Hat offers the Enterprise Messaging product MRG. For MRG longtime support and versions with additional bug fixes are available.

Proton, a subproject of Qpid, is a lightweight implementation of the AMQP protocol. Using proton it is likewise possible to develop clients and servers. Proton is available for C and Java. The C implementation also includes bindings for PHP, Python and Ruby.

RabbitMQ

The RabbitMQ broker was created by the functional language Erlang. Erlang is especially suited for distributed applications, as concurrency and availability is well-supported.

Do not be deterred from that RabbitMQ is implemented in Erlang. Its installation runs quickly and easily at Windows and Mac OS. For programming in Java or other languages client libraries are available.

Using a Plugin allows RabbitMQ to understand protocols such as STOMP. The core of RabbitMQ is fully geared to the AMQP protocol. Unfortunately, there is currently no support for AMQP in version 1.0. But support for AMQP 1.0 is already in the planning.

The management plugin provides an appealing web console that allows easy administration. There also are visualized statistics such as the number of messages per second and the consumption of resources, such as memory, sockets, and the crucial file descriptors.

Figure 5: RabbitMQ Console

ZeroMQ

ZeroMQ is no classic broker, which provides message queues to its clients, but rather a library to create distributed and concurrent applications. The ZeroMQ API is similar to the low level Socket API for communication over networks.

In contrast to a message-oriented middleware no central server is required at ZeroMQ. The sender of a message is responsible for the for routing to the right destination and the receiver of a message is responsible for queuing.

ZeroMQ has got the following notations: MQ, OMQ and ZMQ. ZeroMQ is developed by iMatix who were involved in development of AMQP. Meanwhile iMatix has withdrawn from participation and focuses entirely on ZeroMQ. The approach taken by ZeroMQ is quite elegant and enables topologies from 0 to n nodes or brokers between sender and receiver.

The abandonment of a central broker enables very low latency and high bandwidth. Thus, ZeroMQ is ideal for largest volumes of messages eg for measurement values, for real-time quotes in financial industry or for online games.

Scalability and Reliability

Basically all brokers are highly scalable, robust and reliable. Almost every project praise that as a outstanding property. Therefore, the descriptions of the broker do not separately  mention these properties , unless a broker is significantly different from the others. So, this point is limited as a selection criterion.

The ActiveMQ broker has limitations in terms of scalability, robustness and reliability due to its architecture. But only at extremely high load or at thousands of queues ActiveMQ should show its limits. In practice, ActiveMQ often is more stable than its modern challenger because of its maturity.

Performance

Important in evaluating the speed of a broker is its field of application. Only searching for a fast broker usually is too simplistic. To evaluate the performance of a broker correctly you should ask yourself the following questions:

  • Do I need a broker for financial transactions or online games?
  • What is more important for the use: guaranteed transactional service or speed and bandwidth?
  • How big may be the delay in delivery of messages?
  • What size are the messages to be transmitted?
  • How many queues are needed?
  • How many clients simultaneously access the broker?

Properties such as persistence or transactionality cost performance and cause that messaging solutions without QoS, which keep the news to the main memory, usually are faster.

 

If higher throughput is required, persistence and guaranteed delivery can be disabled. In most cases the performance is despite persistence more than sufficient for many applications.

Even the somewhat dated ActiveMQ can process thousands of messages per second. Usually this is sufficient for most business applications in the fields of finance, insurance and retail. Higher demands on performance is needed in real-time processing of measured values or in online games.

If a throughput of 10 000 or more messages per second is needed, you should take one of the newer broker. The throughput of Apollo, Qpid, RabbitMQ and the other brokers lies between several hundred thousand to several million messages per second. For example, at SpecJMS Benchmark HornetQ has delivered more than 8 million messages per second, tested on a 2 chip machine with 4 cores and 24 GB main memory. For other brokers, there are similar results.

It is very difficult to achieve an objective comparison even with standardized benchmarks because most configurations, features or protocols are different. Several brokers claimed to be the fastest. These statements usually are only valid for a short time and only for a specific scenario.

The aforementioned values allow the conclusion that performance of a broker represents a project risk just in the fewest cases. Therefore the speed is hardly a selection criterion for the benefit of a particular broker.

Practical experience: 
Usually not the brokers is the bottleneck, but message consumer that are slowed down by slow backend systems or database queries.

Message Persistence

So that messages can survive the failure of a broker they have to be saved permanently on disk. For most brokers there are exchangeable Message Stores.

If messages are stored permanently, the used database greatly influences the speed of the broker. Therefore, for the storage of messages specialized databases are used. Messages have to be stored, searched by the name of a queue and be deleted. The modification of messages is not necessary. The databases optimized for these tasks, which mostly access to the hard drive directly, achieve a much better performance in persisting messages as common relational databases. The order of magnitude of the speed difference between a relational database and a special message database lies approximately at ten times.

Despite of speed costs by relational data stores many users want to cache messages in their preferred database. The JDBC store the ActiveMQ broker allows to use any relational database for which there is a JDBC driver. Of course, the Oracle database can be used for storage at ActiveMQ.

JMS Support

An important criterion when choosing a broker is the support of the Java Message Servicestandard. Many existing Java applications are using the JMS API to communicate with a Message Broker. Migration to a new broker then can occur without modifications to the application code.

In ActiveMQ and HornetQ JMS compliance is top of the list of features.

Apache Qpid comes with a JMS client API, which allows clients to connect to it over the AMQP broker. Through this API you can access other JMS brokers such as the RabbitMQ too.

Messaging Protocols

For a long time there was no standard for a messaging protocol. The Java standard JMS only describes the interface, which serves applications to communicate with a broker. The Protocol between the library and the JMS server is depending on the manufacturer.

Figure 6 shows how the same application can be operated with different message brokers using JMS. This application using the standardized JMS API through which it accesses a JMS implementation of a particular broker. In order to run the application with another broker you just have to replace the JMS client library.

Figure 6: JMS Compatibility

Broker does not understand each other because of the different protocols. JMS also does not address the interoperability with other programming languages.

The Advanced Message Queuing Protocol is a standard that would like to fill this gap. AMQP enables collaboration of brokers and clients from different manufacturers and platforms. AMQP describes a binary formatand the necessary application logic. Many major manufacturers set on AMQP. But there is some criticism for the way of standardization caused by the complexity of AMQP.

The approved OASIS standard version AMQP 1.0 from October 2012 is significantly different from previous versions, so that one could speak of a completely separate protocol. The previous versions 0-8, 0-9, 0-9-1 and 0-10-0 are not compatible with each other. Whether AMQP really leads to more interoperability depends on how well the AMQP version 1.0 is accepted and implemented. Support of AMQP 1.0 in ActiveMQ, Apollo and Qpid brokers and announcements for HornetQ and RabbitMQ let hope that AMQP is a success. A decisive factor may be the break with the previous too overloaded version 0-10-0. AMQP 1.0 is compared with the 0-10-0 version a little easier.

A very popular protocol for the integration of scripting languages is text-based STOMP. It's simple, performant and there are a variety of servers and clients. For STOMP there are the most client libraries, for example, C, Objective-C, PHP, Go, Python and Ruby. STOMP is that simple that you can can create a client library for the unlikely event that there is no library with just little effort. The stomp.js library for JavaScript is sizing only 7 Kbytes. To use Web pages with JavaScript as a messaging client STOMP can be combined with the WebSockets protocol. Likewise this is the way to build slim Web 2.0 applications.

The following table lists the supported protocols of each broker.

  ActiveMQ Apollo HornetQ Qpid RabbitMQ ZeroMQ
AMQP 1.0 1.0 announced 1.0 0-8, 0-9, 0-9-1 -
MQTT - - -
OpenWire - - - -
REST - -
STOMP - -
STOMP over Websockets - -
XMPP - - - Over Gateway -

Table 1: Support for Messaging Protocols

 

Client Interfaces

Access to a message broker is not only reserved for Java applications. For many brokers there are client APIs in different programming languages. It is even common for client and broker to use different platforms, eg when a Java application accesses an Erlang written RabbitMQ broker.

Since AMQP has standardized the protocol on the "cable level", it is even possible to connect the AMQP client library of a broker of another broker. For this to work the AMQP versions have to match because each version of the protocol are not compatible.

Through the STOMP protocol different client platforms can be connected to a broker. STOMP is favorited to access a broker with scripting languages such as Perl, PHP and Ruby.

  ActiveMQ Apollo HornetQ Qpid RabbitMQ ZeroQ
C - -
C++ - - -
Erlang - - - -
Haskell - - - -
Java JMS - - -
Java proprietary - -
.NET - - -
Objective-C - - - - -
Perl - - - -
PHP - - - -
Python - - -
Ruby - - -

Dissemination

The ActiveMQ broker has got the largest spread by far. RabbitMQ recently has received much attention.

The embedded Google Trends chart below shows how frequently you searched for the brokers.

Behind the AMQP standard there are many heavyweights in IT and business. Among others Deutsche Börse, JPMorgan Chase, Microsoft, Progress Software, Red Hat, Software AG, U.S. Dept. of Homeland Security and VMware have been involved on the standardization. Since October 2012 AMQP is an official OASIS standard. This all leads to the conclusion that AMQP will find a large spreading.

Summary

As so often in IT the selection of a broker is no royal. With ActiveMQ, there is a proven, fast and widespread Broker whose architecture encounters its limits. The JDBC Message Store is a unique feature of ActiveMQ for data center operations.

Alternatively, there is a series of promising and cool projects, but which are still lacking somewhat in maturity and dissemination. In the projects is a lot of movement, so I assume that in 2013 many brokers will achieve sufficient stability, compatibility, and documentation.

HornetQ is useful when Enterprise Messaging with JMS support is needed. Extensive documentation describes even advanced configurations with transactions and clustering.

Who is looking for a simple broker for Web 2.0 applications, sending & receiving messages using JavaScript or who uses uses scripting languages besides Java should look at Apache Apollo.

If Erlang as a platform is not an exclusion criterion, RabbitMQ could also be interesting. Currently RabbitMQ is still missing the AMQP 1.0 compatibility.

Thomas Bayer
bayer@predic8.com 

Watched Versions

The following list shows the versions which were considered for this article:

  • Apache ActiveMQ 5.7.0
  • Apache Apollo 1.5
  • FFMQ 3.0.1
  • HornetQ 2.3.0.Beta 3
  • JBoss Messaging 2.0.0
  • OpenJMS 0.7.7
  • Qpid 0.18
  • RabbitMQ 3.0.1
  • ZeroMQ 3.2

List of References

AMQP Homepage 
http://www.amqp.org/node/

ActiveMQ Homepage 
http://activemq.apache.org/

STOMP Protocol Specification 
http://stomp.github.com/stomp-specification-1.2.html

HornetQ Homepage 
http://www.jboss.org/hornetq

RabbitMQ support JMS in the future? 
http://rabbitmq.1065348.n5.nabble.com/RabbitMQ-support-JMS-in-the-future-td24361.html

Message Queue Evaluation Notes 
http://wiki.secondlife.com/wiki/Message_Queue_Evaluation_Notes

Enabling the ActiveMQ Broker for AMQP 
http://activemq.apache.org/amqp.html

Open JMS Homepage 
http://openjms.sourceforge.net/

Apache Qpid Homepage 
http://qpid.apache.org/

RabbitMQ Homepage 
http://www.rabbitmq.com/

ZeroMQ Homepage 
http://www.zeromq.org/

时间: 2024-09-30 19:24:43

ActiveMQ, Qpid, HornetQ and RabbitMQ in Comparison的相关文章

软件架构模式转载

概要介绍 最近一两年,转载文章越来越少了,之所以转载这篇文章,是因为看这篇文章,弄明白了我的一些问题.所以梳理了一下,结合了几篇文章. 架构模式可以帮助你定义程序的基本特征和行为.例如一些架构模式很自然让程序成为大规模(scalable)的程序.有些模式让程序变得灵巧敏捷(agile).知道这些架构的特征,优点和缺点,你就可以根据你特定的业务需求和目标从容的选择一种架构模式.作为一位架构师,你总会为自己架构选择做解释,尤其你选择一个特别的架构模式的时候.O'Reilly的这本书提供了充足的信息来

Apache Kafka是分布式发布-订阅消息系统

转自: http://www.infoq.com/cn/articles/apache-kafka?utm_source=infoq&utm_medium=popular_links_homepage 简介 Apache Kafka是分布式发布-订阅消息系统.它最初由LinkedIn公司开发,之后成为Apache项目的一部分.Kafka是一种快速.可扩展的.设计内在就是分布式的,分区的和可复制的提交日志服务. Apache Kafka与传统消息系统相比,有以下不同: 它被设计为一个分布式系统,易

给Java新手的一些建议----Java知识点归纳(J2EE and Web 部分)

J2EE(Java2 Enterprise Edition) 刚出现时一般会用于开发企业内部的应用系统,特别是web应用,所以渐渐,有些人就会把J2EE和web模式画上了等号.但是其实 J2EE 里面并不仅仅是web,可以看到很多其中的规范都是通用的,目的是为了高效开发出健壮的服务企业业务模式的应用系统.J2EE中也是可以没有web界面的应用,而现在面向大众用户开发的网站往往也会使用到很多的J2EE的技术,所以J2EE和web开发的概念都是融合在了一起了. 我本人在JAVA开发刚入行的时候,也是

携程基于Storm的实时大数据平台实践

  本文讲解了携程在实时数据平台的一些实践,按照时间顺序来说明我们是怎么一步一步构建起这个实时数据平台的,目前有一些什么新的尝试,未来的方向是怎么样的,希望对需要构建实时数据平台的公司和同学有所借鉴. 为什么要做实时数据平台 首先先介绍一下背景,为什么我们要做这个数据平台?其实了解携程的业务的话,就会知道携程的业务部门是非常多的,除了酒店和机票两大业务之外,有近20个SBU和公共部门,他们的业务形态差异较大,变化也快,原来那种Batch形式的数据处理方式已经很难满足各个业务数据获取和分析的需要,

58沈剑:三种妙法搞定冗余表数据一致性!

大家好,我是来自58到家的沈剑,在这次DBAplus社群的分享中给大家带来的主题是"冗余表数据一致性保证",主要包括四个方面的内容:   为什么会有冗余表的需求 如何实现冗余表 正反冗余表谁先执行 冗余表如何保证数据的一致性   一  为什么会有冗余表的需求    首先聊聊为什么会有冗余表的需求.互联网很多业务场景的数据量很大,此时数据库架构要进行水平切分,水平切分会有一个patition key,通过patition key的查询能够直接定位到库,但是非patition key上的查

图解:支付宝钱包系统架构剖析

支付宝系统架构概况>> 典型处理默认>> 资金处理平台>> 财务会计>> 支付清算>> 核算中心>> 交易>> 柔性事务>> 支付宝的开源分布式消息中间件 – Metamorphosis(MetaQ)>> Metamorphosis (MetaQ) 是一个高性能.高可用.可扩展的分布式消息中间件,类似于LinkedIn的Kafka,具有消息存储顺序写.吞吐量大和支持本地和XA事务等特性,适用 于大吞

支付宝系统架构

支付宝系统架构概况 典型处理默认 资金处理平台 财务会计 支付清算 核算中心 交易 柔性事务 支付宝的开源分布式消息中间件–Metamorphosis(MetaQ) Metamorphosis (MetaQ) 是一个高性能.高可用.可扩展的分布式消息中间件,类似于LinkedIn的Kafka,具有消息存储顺序写.吞吐量大和支持本地和XA事务等特性,适用 于大吞吐量.顺序消息.广播和日志数据传输等场景,在淘宝和支付宝有着广泛的应用,现已开源. Metamorphosis是淘宝开源的一个Java消息

消息中间件kafka与activemq、rabbitmq、zeromq、rocketmq的比较

  消息队列(Message Queue,简称 MQ)是阿里巴巴集团中间件技术部自主研发的专业消息中间件. 分布式消息系统作为实现分布式系统可扩展.可伸缩性的关键组件,需要具有高吞吐量.高可用等特点.而谈到消息系统的设计,就回避不了两个问题: 常用消息队列有:kafka.activemq.rabbitmq等.   一.kafka: 1.不完全符合jms规范,注重吞吐量,类似udp 和 tcp: 2.一般做大数据吞吐的管道 我们现在的用途就是负责在各个idc之间通信: 3.量大 对数据不是百分之百

RabbitMq、ActiveMq、ZeroMq、kafka之间的比较,资料汇总

本文转载自:http://blog.csdn.net/linsongbin1/article/details/47781187 ---------------------------------------------------------------------------------------------------- MQ框架非常之多,比较流行的有RabbitMq.ActiveMq.ZeroMq.kafka.这几种MQ到底应该选择哪个?要根据自己项目的业务场景和需求.下面我列出这些MQ