Handbooks  /  Kafka vs RabbitMQ
Engineering~9 min readComparison
Head to Head

Kafka vs RabbitMQ: a log, or a queue?

KafkavsRabbitMQ

These both "move messages between services", which is exactly why teams pick the wrong one. Underneath they’re opposite designs: Kafka is a durable, replayable log where consumers remember their place; RabbitMQ is a smart broker that routes each message and forgets it once acknowledged. That difference decides almost everything.

01

The core difference: remember vs forget

Kafka is an append-only log. Messages are written to partitions and kept (for days, or forever); each consumer tracks its own offset — its position in the log. Many consumers read the same messages independently, and anyone can rewind and replay history. RabbitMQ is a message broker: a producer sends to an exchange, the broker routes it to queues by rules, a consumer takes it, acknowledges, and it’s deleted. The broker does the thinking; the message is transient.

→ The rule

Want an event history many services replay and reprocess — a stream of what happened? That’s Kafka. Want to hand tasks to workers with flexible routing, priorities, and per-message delivery — a job distributor? That’s RabbitMQ.

02

Head to head

DimensionKafkaRabbitMQ
ModelDistributed append-only logSmart routing broker + queues
After consumptionMessage stays (consumers track offsets)Message deleted on ack
ReplayYes — rewind to any offsetNo — it’s gone once acked
ThroughputVery high (millions/sec)High, but lower than Kafka
RoutingSimple (topic + partition)Rich (direct, topic, fanout, headers)
OrderingGuaranteed within a partitionPer-queue, weakens with competing consumers
Multiple consumersEach reads the whole stream independentlyCompete for messages (work-sharing)
Best fitEvent streaming, logs, analytics, CDCTask queues, RPC, complex routing
03

When to use each

Reach for Kafka

  • Event streaming many services subscribe to
  • You need replay / reprocessing of history
  • Very high throughput (logs, metrics, clicks)
  • Change-data-capture, event sourcing
  • Strict ordering within a key/partition

Reach for RabbitMQ

  • Distributing tasks to a pool of workers
  • Complex routing (priorities, topics, fanout)
  • Request/reply and RPC patterns
  • Per-message TTL, dead-letter queues
  • Lower operational weight for modest scale
→ Not either/or at scale

Big systems run both: Kafka as the durable event backbone (the source of truth for what happened) and RabbitMQ where flexible task routing and low-latency work distribution matter. Pick by the job in front of you, not by which is "better".

04

Why Kafka's throughput ceiling is so much higher

The throughput gap isn't an implementation detail — it falls directly out of the two systems' core designs. RabbitMQ's broker does real work per message: it evaluates routing rules against an exchange, decides which queue(s) a message belongs in, tracks per-message acknowledgment state, and often persists to disk per-message for durability. That's real CPU and I/O work, multiplied by every single message, and it's exactly what makes RabbitMQ's routing so flexible.

Kafka sidesteps almost all of that. A producer writes to a partition, which is nothing more than an append to a sequential log file — the cheapest possible disk operation, and one modern disks (especially SSDs) handle at extraordinary rates. Kafka doesn't inspect message content to route it (the producer already picked the partition), doesn't track per-message state (consumers track their own offset, not the broker), and batches aggressively — grouping many messages into one disk write and one network round-trip. The result is a system built almost entirely around sequential I/O and batching, which is why a modest Kafka cluster can sustain millions of messages per second while a comparably-sized RabbitMQ cluster tops out dramatically lower. The lesson generalizes: RabbitMQ's intelligence lives in the broker per-message; Kafka pushes that intelligence to the edges (producers choose partitions, consumers choose what to read) and keeps the hot path as close to "just append to a file" as possible.

→ The trade you're actually making

RabbitMQ's per-message routing intelligence costs throughput ceiling. Kafka's throughput ceiling costs per-message routing intelligence — you get a topic and a partition key, not a rules engine.

05

A worked scenario: order events across five services

Say an e-commerce checkout needs to notify five downstream services when an order completes: inventory, billing, shipping, analytics, and fraud review. With RabbitMQ, you'd publish one message to a fanout (or topic) exchange, and RabbitMQ copies it into five separate queues — one per consumer. Each service processes and acknowledges independently; once all five have acked their copies, the message's job is done and it's gone. If a sixth service launches next quarter needing the same event, you bind a new queue to the exchange going forward — but it only sees events from the moment it started listening. There's no "replay the last 30 days of orders" without a separate mechanism.

With Kafka, the order-completed event is appended once to an orders topic partition. All five services subscribe independently and each tracks its own offset into that same, single copy of the log — Kafka doesn't duplicate the message per consumer the way RabbitMQ's fanout does. When fraud review ships a new ML model next quarter and needs to re-score the last 90 days of orders, it simply resets its consumer offset to 90 days ago and re-reads the same log everyone else is still consuming live from — no special replay infrastructure, because replay is just "read from an earlier offset," the same operation as normal consumption.

→ The pattern generalizes

Anywhere "add a new consumer of history we've already produced" is a real requirement — audit logs, ML feature backfills, debugging a production incident by replaying the events that led to it — Kafka's retained log is a structural fit. Anywhere the requirement is "deliver this once, to whoever's listening right now, with rich routing," RabbitMQ's transient queue model is the simpler tool.

06

Common mistakes

MistakeWhy it bites
Using Kafka as a task queue for one-off jobsKafka has no per-message acknowledgment, no built-in retry-with-backoff for a single failed item, and no priority queues — semantics RabbitMQ was built for. Forcing Kafka into "distribute this job to exactly one worker" reinvents machinery RabbitMQ ships natively.
Assuming more Kafka partitions always means more throughputPartitions are also the unit of parallelism for consumers and the unit of ordering guarantee — over-partitioning fragments ordering-sensitive keys across too many partitions and adds real overhead (open file handles, replication traffic) with no throughput benefit past what your consumers can actually parallelize.
Expecting global ordering from KafkaKafka only guarantees order within a partition, not across the whole topic. Two events for different customers, or even the same customer if not keyed consistently, can arrive out of order relative to each other across partitions — the producer's partition key is what determines what stays ordered.
Running RabbitMQ with unbounded queues under a slow consumerUnlike Kafka's log (which just keeps growing on cheap disk), a RabbitMQ queue backing up behind a stalled consumer consumes broker memory directly and can bring the broker down — queue length limits, TTLs, or dead-lettering are not optional at any real scale.
Your call

Which would you pick?

Three situations. Pick the side you'd actually build — the explanation follows.

You need to hand one-off jobs to a worker pool: each job goes to exactly one worker, failures retry with backoff, and urgent jobs jump the queue.

Order events must be consumed by five services, and a sixth is coming next quarter that will need to replay the last 30 days from the beginning.

Throughput is short of target, so someone proposes raising the topic from 12 partitions to 200.

Frequently asked

Quick answers

What is the main difference between Kafka and RabbitMQ?

Kafka is a durable, replayable log: messages are kept and each consumer tracks its own position, so many services can read the same stream and rewind history. RabbitMQ is a broker that routes each message to a queue and deletes it once a consumer acknowledges. Kafka remembers; RabbitMQ forgets.

Which has higher throughput, Kafka or RabbitMQ?

Kafka, by a wide margin — it is built for millions of messages per second via partitioned, sequential-disk writes. RabbitMQ handles high throughput too but is optimized for flexible routing and per-message delivery rather than raw stream volume.

Can RabbitMQ replay messages like Kafka?

Not natively. Once a RabbitMQ message is acknowledged it is deleted, so there is no rewind. Kafka keeps messages for a configured retention (days to forever), so any consumer can replay from any offset — essential for reprocessing and event sourcing.

When should I use RabbitMQ over Kafka?

When you are distributing tasks to workers and need rich routing (priorities, topic/fanout exchanges, dead-letter queues) or request/reply patterns, and you do not need to replay history. RabbitMQ is often simpler to operate at modest scale.

▶  Watch it explained

Kafka vs RabbitMQ: a log, or a queue?

Kafka vs RabbitMQ · Engineering · Vibe Engines · 2026
Finished this one? 0 / 208 Handbooks done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Handbooks