ActiveMQ, HornetQ and RabbitMQ Performance Comparison

Messaging could be a great solution for a lot of projects regarding an inter-systems (and components) communication. But which vendor to choose? Which one is the best?

There is no proper answer for this question, because each and every provider has some pros and cons. Please read the first description of all of them and figure out only those matching your requirements.

If your results include ActiveMQ, HornetQ and RabbitMQ, you are propably interested in performace and some practical observations now. And that is what is this article all about.


What is tested

We leave all the brokers in the default setting, no additional tuning was done yet. If you have some special requirement, you should probably look deeply at the features of the brokers and count in the final results.

We run the same performance test for several scenarios:

  1. One broker, one producer, one consumer on the only one server.
  2. One broker running on the server one, one producer, one consumer running on the server 2.
  3. Two brokers running on different servers (forwarding messages / bridging), one producer  running on the server 1, one consumer running on the server 2.

scenarios
Image 1: Scenario 1, 2 and 3 architecture

We also run the test with different setting of clients:
  1. queues, topics
  2. non-persistent, persistent massages
  3. one or ten threads for a queue/topic (one or ten message producers and consumers in parallel)
Because proportion of the results for the different scenarios is almost the same, we can focus only on the first scenario to invest the results and do the comparison.

Results

Parameters for the run:

Running on Linux system in virtual machine with 2 cores and 8 GB RAM.

Results table
queues
1
1
1
1
10
10
10
10
consumers (per queue)
1
1
10
10
10
10
1
1
producers (per queue) 1
1
10
10
10
10
10
10
message body size (bytes)
128
2048
128 2048 128 2048 128 2048
ActiveMQ (msg/sec) 14590 14565 15700 15640 17920 17995 18180 19220
HornetQ (msg/sec) 46605 47830 10140 10802 16165 18885 19852 19905
RabbitMQ (msg/sec) 20550 14680 14422 13065 13770 12150 13800 11930

results
Image 2: Results chart

My point of view

ActiveMQ is very good tool with lot of documentation, examples, support and a huge community. Is it not the best regarding the performance, but it is announced to be rapidly improved by the version 6 using Appolo module. We will see...

HornetQ really shines in the performance and it is pretty useful with a good support as well, but a lot of features (for instance the management console) is tightly  bound with running as a JBoss module. Running in a stand-alone mode (as I did) has several disadvantages and I would not recomment it. But if you are using (or going to use) the JBoss Application Server for running you web application, HornetQ could the right option for you.

There is a bit mess in versioning of libraries, especially if you want to work with different vendors of components involved in the integration (Netty, Spring JMS, ...).

Queues and topics must be declared in hornetq-jms.xml before and cannot be created and deleted dynamically using JMS API.

RabbitMQ does not have a good performance and it is not very human-friendly (all the setting are written in Erlang, which makes longer configurations very unclear for a programmer).

There is only a commercial implementation of JMS. You can use pure RabbitMQ libraries or the Spring AMQP, but it is a different approach from JMS and has several limitations, for instance AMQP 0-9-1 protocol used as native doesn't support durable subscribers.