Architecture · Updated November 2026

Kafka vs RabbitMQ:
Choosing the Right Broker

Raffael Hühnerschulte · 12 min read
Left: messages routed into queues and consumed; right: an append-only log read by several consumers at different offsets

Few technology decisions generate more heated debate in architecture reviews than the choice between Apache Kafka and RabbitMQ. Both are mature, battle-tested, and widely deployed. Both handle messages between services. And both communities will tell you their tool is obviously the right choice.

In reality, they solve different problems. The confusion arises because those problems overlap enough that either can technically work — but using the wrong one means fighting your infrastructure for years. I've seen both mistakes in production, and they're not subtle when they happen.

The core distinction RabbitMQ is a message broker. Kafka is an event streaming platform. This distinction sounds academic until you're debugging why your system behaves incorrectly at scale.

How Each System Thinks About Messages

RabbitMQ: Messages as Tasks

RabbitMQ was built around the AMQP protocol and the metaphor of a post office. A producer sends a message to an exchange. The exchange routes that message to one or more queues based on rules (direct, fanout, topic, headers). A consumer picks up the message, processes it, and acknowledges it. The message is then removed from the queue.

This is the key behavior: once processed and acknowledged, the message is gone. RabbitMQ is designed for transient work — tasks that have a clear destination and a clear completion state. Order processing, email dispatch, notification delivery, background jobs. If something goes wrong, messages can be dead-lettered and requeued, but the base model is consume-and-discard.

Kafka: Events as a Log

Kafka thinks about messages entirely differently. Instead of a queue, Kafka has a log — an append-only, ordered, persistent sequence of events. Producers write events to a topic (a named log). Consumers read from that log at their own pace, tracking their position (offset) independently.

The events stay in the log for a configurable retention period (days, weeks, or indefinitely). Multiple consumer groups can read the same events completely independently. A new service can be added and replay the entire history. An existing service can be restarted and continue from where it left off.

This is a fundamentally different model: the log is the source of truth, not just a transit lane.

Where Each Excels

Apache Kafka

  • Event streaming & real-time pipelines
  • High-throughput data ingestion (millions of events/sec)
  • Event sourcing & CQRS architectures
  • Audit logs & compliance requirements
  • Fan-out to many independent consumers
  • Replay capability for reprocessing
  • Stream processing (Kafka Streams, Flink)

RabbitMQ

  • Task queues & background job processing
  • Complex routing logic (topic exchanges)
  • Priority queues
  • Request-reply patterns (RPC over messaging)
  • Per-message TTL and expiry
  • Small teams, simpler operational model
  • Low-latency delivery (< 1ms typical)

The Numbers That Actually Matter

Dimension RabbitMQ Kafka
Throughput ~50K msg/sec per node Millions/sec across cluster
Latency <1ms typical 5–15ms typical
Message retention Until consumed Configurable (days/weeks/forever)
Consumer model Push (broker delivers) Pull (consumer polls)
Ordering guarantee Per-queue (single consumer) Per-partition (strict)
Operational complexity Low to medium Medium to high
Horizontal scaling Federation, shovel Native partition-based

Kafka vs RabbitMQ Performance: What Actually Drives the Numbers

The table above gives orders of magnitude, not promises. In real benchmarks the configuration matters more than the product: a badly tuned Kafka cluster loses to a well-tuned RabbitMQ, and vice versa. These are the levers that move throughput and latency the most.

Kafka: throughput comes from batching

RabbitMQ: latency comes from flow control

Benchmark it yourself

Both projects ship load-test tools. Run them with your message size, durability settings and consumer count — not the defaults:

# Kafka: 1 million 1 KB records, durable writes
bin/kafka-producer-perf-test.sh --topic perf-test --num-records 1000000 \
  --record-size 1024 --throughput -1 \
  --producer-props bootstrap.servers=localhost:9092 acks=all linger.ms=10 compression.type=lz4

bin/kafka-consumer-perf-test.sh --bootstrap-server localhost:9092 \
  --topic perf-test --messages 1000000

# RabbitMQ: PerfTest with quorum queues, persistent messages and confirms
java -jar perf-test.jar --uri amqp://localhost --queue-args x-queue-type=quorum \
  --flag persistent --confirm 100 --producers 2 --consumers 2 \
  --size 1024 --qos 200 --time 60

Compare p99 latency at your expected load, not the maximum throughput. Most systems never reach the limits of either broker; they do hit tail latency and consumer lag.

What Changed in 2025–2026

The Same Use Case in Spring Boot

An order service publishes an OrderPlaced event. With Kafka the event goes into a log that any number of services can read; with RabbitMQ it is routed into queues and removed once processed.

// Kafka (spring-kafka): key = orderId keeps all events of one order in order
@Service
class OrderEventsKafka {
  private final KafkaTemplate<String, OrderPlaced> kafka;
  OrderEventsKafka(KafkaTemplate<String, OrderPlaced> kafka) { this.kafka = kafka; }

  void publish(OrderPlaced e) { kafka.send("orders", e.orderId(), e); }

  @KafkaListener(topics = "orders", groupId = "billing")
  void bill(OrderPlaced e) { /* every group (billing, analytics …) gets its own copy */ }
}

// RabbitMQ (spring-amqp): routed via a topic exchange, gone after ack
@Service
class OrderEventsRabbit {
  private final RabbitTemplate rabbit;
  OrderEventsRabbit(RabbitTemplate rabbit) { this.rabbit = rabbit; }

  void publish(OrderPlaced e) { rabbit.convertAndSend("orders", "order.placed", e); }

  @RabbitListener(queues = "billing.orders")
  void bill(OrderPlaced e) { /* competing consumers share the queue's work */ }
}

The code looks almost identical. The difference is in what happens after the listener returns: Kafka keeps the event for replay, RabbitMQ deletes it. That is the decision you are really making.

Common Mistakes I See in Practice

Using Kafka as a task queue

Kafka has no native concept of "acknowledge and delete." If you put tasks into Kafka and want exactly-once processing with clear completion semantics, you have to build this logic yourself — tracking consumer offsets, handling idempotency, managing consumer group assignments when services scale. Teams underestimate this work consistently. For task queues, RabbitMQ with proper dead-lettering is half the code and twice the reliability.

Using RabbitMQ for fan-out at scale

Fanout exchanges in RabbitMQ work well for a handful of consumers. But each queue gets a full copy of every message. At high throughput with many consumers, you're now multiplying your storage and memory usage. Kafka's consumer group model — where all members of a group share a partition, but different groups each get a full copy — scales to dozens of consumers without this overhead.

Choosing Kafka for greenfield projects "to be safe"

This is the most common mistake I see from teams who've read the right blog posts but haven't operated production Kafka. ZooKeeper is gone since Kafka 4.0 (KRaft only), but production Kafka still needs careful partition sizing, replication factor decisions, schema registry for Avro/Protobuf, monitoring for consumer lag, and operators who understand the operational model deeply. For a team of three building a new product, this is often a multi-month distraction from the actual product.

When in doubt Start with RabbitMQ. The migration path from RabbitMQ to Kafka as requirements grow is well-documented and manageable. The reverse — rearchitecting Kafka-native event sourcing down to a simple task queue — is painful.

A Practical Decision Guide

Ask these questions about your specific use case:

  1. Do you need to replay events? If you need to reprocess historical events, audit past state, or add new consumers that need full history — Kafka.
  2. Do you have >5 independent consumers of the same event stream? Kafka's consumer group model handles this naturally. RabbitMQ fanout gets expensive.
  3. Is your throughput measured in tens of thousands per second or more? Kafka. Under that, RabbitMQ's simpler operations won't be a bottleneck.
  4. Do you need complex routing (topic patterns, header matching, priority)? RabbitMQ's exchange types handle this natively.
  5. Is this a task with a clear completion? ("Send this email", "Process this order") RabbitMQ's acknowledge-and-delete model fits perfectly.
  6. Is your team smaller than 5 engineers? Strongly consider RabbitMQ first. Kafka's operational burden is real.

When to Use Both

In larger systems, using both is common and sensible — they're complementary, not competing. A typical pattern: Kafka handles the high-volume event stream (user activity, telemetry, order events), while RabbitMQ handles the downstream task dispatch (sending emails, triggering enrichment jobs, scheduling reports). Each tool does what it's best at.

The integration point is usually a Kafka consumer that translates events into RabbitMQ tasks. Keep that boundary thin and well-tested.

FAQ: Kafka vs RabbitMQ

Is Kafka faster than RabbitMQ?

For raw throughput, yes: Kafka batches records and scales horizontally across partitions, reaching millions of events per second in a cluster. For low latency on individual messages, RabbitMQ is usually faster. Which matters depends on whether you move large event streams or many small tasks.

Can Kafka replace RabbitMQ?

Partly. Share groups (Queues for Kafka) add queue-style consumption, but RabbitMQ still offers richer routing, message priorities, per-message TTL and request-reply. Many systems run both: Kafka for the event backbone, RabbitMQ for task dispatch.

Can RabbitMQ replay messages like Kafka?

Classic and quorum queues cannot — messages are removed after acknowledgement. RabbitMQ Streams provide an append-only log with replay, which covers moderate fan-out and reprocessing without adding Kafka.

Which is easier to operate?

RabbitMQ, for most teams. Kafka got simpler with KRaft, but partition sizing, replication, schema management and consumer-lag monitoring still require experience. Small teams without a platform team should start with RabbitMQ unless they need replay or very high throughput.

When should I use both Kafka and RabbitMQ?

When you have a high-volume event stream that several services consume and downstream work items with a clear completion state. A thin consumer translates Kafka events into RabbitMQ tasks; keep that boundary small and well-tested.

Go Deeper

Final Thought

Kafka and RabbitMQ are both excellent systems built by smart people to solve specific problems. The teams that struggle with them are the ones who adopted without clearly understanding what problem they're solving. Before the next architecture discussion, settle this question first: are you building a task pipeline or an event log? The answer should drive the rest of the conversation.

Need architecture training for your team?

I run workshops on event-driven architecture, message broker selection, and Kafka/RabbitMQ in production — tailored to your system, your team's level, and your real design challenges.