RocketMQ vs Kafka: Detailed Feature, Performance, and Reliability Comparison

This article provides a comprehensive comparison between RocketMQ and Kafka, covering data reliability, performance, queue capacity, real‑time delivery, retry mechanisms, ordering guarantees, scheduled messages, transactional support, query capabilities, message tracing, consumer parallelism, filtering, and commercial backing, helping engineers choose the right messaging middleware for their workloads.

Selected Java Interview Questions
Selected Java Interview Questions
Selected Java Interview Questions
RocketMQ vs Kafka: Detailed Feature, Performance, and Reliability Comparison

Alibaba's internal transaction system originally used a self‑developed Notify middleware with MySQL for message storage. After reviewing Kafka, the team created RocketMQ in Java to provide reliable non‑log message transmission, which is now widely deployed across Alibaba for orders, transactions, recharge, stream computing, push notifications, log processing, and binlog distribution.

To aid selection, a comparison document between RocketMQ and Kafka was compiled; readers are invited to report any errors to [email protected].

Data Reliability

RocketMQ supports asynchronous real‑time flushing, synchronous flushing, synchronous replication, and asynchronous replication.

Kafka uses asynchronous flushing and asynchronous replication only.

Conclusion: RocketMQ’s synchronous flushing offers higher single‑node reliability than Kafka, preventing data loss on OS crashes, and its synchronous replication is more reliable than Kafka’s asynchronous replication, eliminating single points of failure.

Kafka’s replication is topic‑based and can automatically switch to a backup broker after a failure, but asynchronous replication may cause data loss and leader conflicts after a restart. Open‑source RocketMQ does not support automatic master‑slave switch; the Alibaba Cloud version does.

Performance Comparison

Kafka single‑node write throughput is about 1 million messages/second for 10‑byte messages.

RocketMQ single‑node write throughput is about 70 k messages/second; three brokers on one machine can reach up to 120 k messages/second for 10‑byte messages.

Conclusion: Kafka achieves higher TPS mainly because the producer batches many small messages before sending.

Supported Queue Count per Node

Kafka’s performance degrades noticeably when the number of queues/partitions exceeds 64.

RocketMQ can support up to 50 000 queues on a single node without significant load increase.

More queues allow creation of more topics and enable larger consumer clusters, as consumer scale is proportional to queue count.

Message Delivery Real‑Time

Kafka uses short polling; real‑time latency depends on the poll interval.

RocketMQ uses long polling with a push model, achieving delivery delays of only a few milliseconds.

Consumer Failure Retry

Kafka does not support retry on consumption failure.

RocketMQ supports scheduled retries with progressively increasing intervals.

This is useful for scenarios like recharge operations where a temporary failure can be resolved by retrying later.

Strict Message Ordering

Kafka can preserve order but may produce disorder when a broker crashes.

RocketMQ guarantees strict ordering; if a broker fails, new messages are blocked rather than reordered.

Strict ordering is required for MySQL binlog distribution.

Scheduled Messages

Kafka does not support scheduled messages.

RocketMQ supports two levels of scheduled messages: the open‑source version supports level‑based scheduling, while Alibaba Cloud ONS adds millisecond‑precision delays.

Distributed Transaction Messages

Kafka does not support distributed transactional messages.

Alibaba Cloud ONS supports distributed scheduled messages, and the open‑source RocketMQ plans to add full transactional support.

Message Query

Kafka lacks message query capabilities.

RocketMQ allows lookup by Message ID and by Message Key (e.g., an order ID), facilitating debugging of lost or failed messages.

Message query is valuable for pinpointing whether a failure is due to missing messages or processing errors.

Message Backtracking

Kafka can backtrack by offset.

RocketMQ can backtrack by timestamp with millisecond precision, enabling replay from any specific moment.

This is helpful for re‑processing data when a consumer’s logic or downstream systems have changed.

Consumer Parallelism

Kafka’s parallelism equals the number of partitions; each partition can be consumed by one thread on a machine.

RocketMQ’s parallelism:

In ordered consumption, it matches Kafka’s behavior.

In unordered consumption, parallelism depends on the number of consumer threads, allowing many more concurrent consumers per queue.

Message Tracing

Kafka does not provide message tracing.

Alibaba Cloud ONS offers message tracing capabilities.

Developer Language Friendliness

Kafka is written in Scala.

RocketMQ is written in Java.

Broker‑Side Message Filtering

Kafka lacks broker‑side filtering.

RocketMQ supports two filtering methods:

Tag‑based filtering, similar to sub‑topics.

Custom Java code uploaded to the broker for arbitrary filtering, including message body inspection.

Message Accumulation Capacity

Kafka theoretically has higher accumulation capacity, but RocketMQ can handle billions of messages on a single node, which is sufficient for most business needs.

Open‑Source Community Activity

Kafka’s community updates are relatively slow.

RocketMQ’s GitHub community includes over 250 users and a QQ group of more than 1 000 members.

Commercial Support

Kafka’s original developers formed a new company, but no commercial product is currently visible.

RocketMQ is available as a public‑beta service on Alibaba Cloud with a 99.99% reliability guarantee, eliminating the operational complexity of self‑hosting.

Maturity

Kafka is mature in the logging domain.

RocketMQ is heavily used within Alibaba Group, handling massive traffic during events like Double‑11, proving its robustness for peak‑shaving and load‑leveling.

For further learning, Java advanced video resources are recommended.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Distributed SystemsperformanceKafkaMessage QueueReliabilityRocketMQ
Selected Java Interview Questions
Written by

Selected Java Interview Questions

A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.