Updated on 2022-08-15 GMT+08:00

Comparing Kafka and RabbitMQ

Kafka is pull-based and provides higher throughput. It is suitable for collecting and delivering large volumes of data, such as collecting and analyzing logs. RabbitMQ does not provide as high throughput as Kafka, but it offers more message queuing functions.

The following is a comparison analysis on the performance, data reliability, service availability, and functions of Kafka and RabbitMQ.

Performance

The performance of message-oriented middleware is measured by throughput. While RabbitMQ provides tens of thousands of QPS, Kafka provides millions.

However, if idempotency and transactions are enabled for Kafka, its performance will be compromised.

Data Reliability

Both Kafka and RabbitMQ provide the replication mechanism to ensure high data reliability.

Service Availability

Kafka runs in clusters and has partitions and replicas. Therefore, failure of a single broker does not affect services and the capacity of Kafka can be linearly scaled up.

Functions

Both Kafka and RabbitMQ are popular open-source message-oriented middleware. They differ mainly in the functions, which are listed in the following table.

Table 1 Function differences between Kafka and RabbitMQ

Function

Kafka 1.1.0/2.3.0

RabbitMQ 3.7.17

Priority queue

Not supported

Supported. It is recommended that the priority be set to 0–10.

Delayed queue

Not supported

Supported

Dead letter queue

Not supported

Supported

Retry

Not supported

Not supported

Retrieval mode

Pull-based

Pull-based and push-based

Message broadcasting

Supported

Supported

Message tracking

Supports offset and timestamp tracking.

Not supported. Once a message retrieval has been acknowledged, RabbitMQ will be notified that the message can be deleted.

Message accumulation

Supports higher accumulation performance than RabbitMQ thanks to high throughput.

Supported

Persistence

Supported

Supported

Message tracing

Not supported

Supported by the firehose feature or the rabbitmq_tracing plugin. However, rabbitmq_tracing reduces performance and should be used only for troubleshooting.

Message filtering

Supported

Not supported, but can be encapsulated.

Multi-tenancy

Not supported

Supported

Multi-protocol

Only Apache Kafka is supported.

RabbitMQ is based on AMQP and supports MQTT and STOMP.

Multi-language

Kafka is written in Scala and Java and supports clients in multiple programming languages.

RabbitMQ is written in Erlang and supports clients in multiple programming languages.

Throttling

Supports throttling on producer or consumer clients and users.

Supports credit-based throttling on producers, a mechanism that triggers protection from within.

Ordered message delivery

Supports partition-level FIFO.

Supports FIFO only for single-threaded message queuing without advanced features such as delayed queues or priority queues.

Security

Supports SSL and SASL authentication and read/write permissions control.

Similar to Kafka.

Idempotency

Supports idempotency for a single producer session.

Not supported

Transaction messages

Supported

Supported

The comparison is made between open-source Kafka and RabbitMQ.

DMS for Kafka and DMS for RabbitMQ maintain open-source compatibility while supporting or enhancing features in the open-source versions.