Kafka vs RabbitMQ: Which Failure Mode Are You Buying?
Most comparisons between Kafka and RabbitMQ read like a real estate listing. Kafka: high throughput, distributed log, great for streaming. RabbitMQ: flexible routing, low latency, great for task queues. Pick the one that sounds like your problem. The comparison table ends, you make a choice, and six months later you are in an incident call trying to explain to your team why the system is behaving in a way nobody anticipated.
The comparison table approach fails because it describes what each system does well and leaves out what each system does when things go wrong. That is the only part that matters in production. The previous piece in this series introduced a four-question framework for trade-off thinking: what are we optimising for, what are we sacrificing, what breaks first, and how do we recover. This piece applies that framework to Kafka and RabbitMQ specifically, because the failure modes of these two systems are not just different in degree, they are different in kind, and choosing the wrong one means you inherit a class of problems your architecture was not designed to handle.
The thing each system is actually optimising for
Kafka is optimised for retaining events and serving them to multiple independent consumers at high throughput. The core data structure is an append-only log. Producers write to the end of the log. Consumers read from whatever offset they last committed. The log persists based on a retention policy you configure. Nothing gets deleted on consumption. Multiple consumer groups can read the same log independently, each maintaining its own position, completely unaware of each other.
RabbitMQ is optimised for routing work to the right consumer and confirming that the work was done. The core data structure is a queue. Producers publish to an exchange. The exchange applies routing rules and pushes messages to one or more queues. Consumers pull from queues and send acknowledgements. When a consumer acknowledges a message, the broker deletes it. The queue exists to be emptied.
These are not different implementations of the same idea. They are different ideas. Kafka is a log that happens to support consumption. RabbitMQ is a work dispatcher that happens to buffer messages while workers are busy. Conflating them because both involve producers and consumers sending data is roughly like conflating a database with a cache because both store data and respond to queries.
What Kafka’s failure mode actually looks like
Applying the framework to Kafka. What are we optimising for: throughput, event retention, and the ability for multiple independent systems to consume the same events at their own pace. What are we sacrificing: per-message latency, operational simplicity, and any assumption that consumers are keeping up with producers.
What breaks first is consumer lag. Consumer lag is the distance between the latest offset written to a partition and the offset the consumer has committed. Under normal operation, lag exists transiently and recovers quickly. Under sustained load where producers outpace consumers, lag accumulates. The broker does not slow down producers to protect consumers. It does not notify you that a consumer group is falling behind except through metrics you have to be watching. If consumers fall behind beyond the configured retention period, older log segments may be deleted before they are consumed. The data is gone and there is no recovery path from the broker side. Whatever the consumer was supposed to do with those messages does not happen, silently, unless you built alerting for exactly this scenario.
How do we recover from growing consumer lag: add consumer instances up to the partition count, since one consumer per partition is the ceiling for parallelism within a group. If the partition count is the bottleneck, increase partitions, which requires a rebalance. Repartitioning a live topic in production is not catastrophic but it requires care and brief consumer interruption. If the consumer itself is slow because of a downstream dependency, the fix is in the consumer logic, not the broker configuration, which means you are debugging application code under production pressure.
The less obvious Kafka failure mode is the rebalance storm. When consumers join or leave a consumer group, Kafka triggers a rebalance that redistributes partition assignments across the current members. During the rebalance, consumption pauses. In a large consumer group processing high-volume topics, a poorly timed rebalance can cause a visible processing gap. Kubernetes rolling deployments that replace pods gradually are particularly good at triggering rebalances repeatedly, because each pod restart is a consumer leaving and rejoining the group. Kafka’s cooperative incremental rebalancing reduces this, but it requires configuration and is not the default in all client versions.
What RabbitMQ’s failure mode actually looks like
Applying the framework to RabbitMQ. What are we optimising for: reliable delivery of individual messages to exactly one consumer, with broker-side routing, acknowledgement tracking, and failure handling through dead letter queues. What are we sacrificing: event history, replay capability, and the ability for multiple independent consumers to read the same message.
What breaks first is queue depth under sustained backpressure. RabbitMQ is optimised for low-latency in-memory operations, but persistent queues and messages may be written to disk depending on configuration and broker memory pressure. When producers outpace consumers, messages accumulate. The broker monitors memory usage and when it hits a configurable threshold, it triggers flow control, which pauses publishers until consumers catch up. At extreme queue depths, RabbitMQ pages queues to disk, which causes latency spikes because disk I/O is now in the critical path for operations that were previously in-memory. The system does not crash. It degrades, which is in some ways worse because the degradation is gradual, the latency spikes look intermittent, and the root cause is not obvious until you look at queue depth metrics.
How do we recover from growing queue depth: add consumer instances, which distributes the work across more workers and drains the queue faster. Unlike Kafka, adding consumers to RabbitMQ does not require repartitioning anything. The queue simply round-robins messages across however many consumers are connected. This makes RabbitMQ easier to scale horizontally in the short term, at the cost of losing ordering guarantees once you have more than one consumer, which is fine for most task queue workloads and catastrophic for any workload where processing order matters.
The less obvious RabbitMQ failure mode is the prefetch trap. By default, RabbitMQ prefetches messages to consumers aggressively. If you have three consumers and one of them is slow, that slow consumer might have a hundred messages buffered locally while the other two sit idle. The queue is not empty but the fast consumers cannot access the messages because they are held by the slow one. Setting prefetch_count = 1 fixes this by telling the broker to only deliver the next message after the previous one is acknowledged, which distributes work fairly across heterogeneous consumers. Most teams discover this configuration exists after their first incident where queue depth looked healthy but processing was stalled.
The failure you cannot fix after the fact
RabbitMQ has no replay. Once a message is acknowledged, it is gone. If you need to reprocess historical events, onboard a new service against past data, or debug a production issue by replaying the sequence of events that led to a bad state, RabbitMQ cannot help you. This is not a configuration problem or a version limitation. It is structural. The queue model is designed to forget processed work. Building replay capability on top of RabbitMQ means storing the messages somewhere else before they are consumed, which at that point you have built a log on top of a queue, and you should have used a log to begin with.
Kafka retains events for as long as the retention policy allows, which can be days, weeks, or indefinitely with the right storage configuration. A new service can read the full event history from offset zero. A bug in a consumer can be fixed and the consumer can reprocess from the point where the bad processing started. An audit trail of what happened and in what order is available by default, without any additional infrastructure. The failure mode you are buying with Kafka is consumer lag and operational complexity. The failure mode you are buying with RabbitMQ is the permanent loss of any message that was acknowledged before you realised you needed it again.
Ordering and the competing consumer trap
Both systems guarantee ordering, but with constraints that are almost opposite in character. One thing worth understanding before anything else: Kafka’s ordering guarantee applies within a partition, not across the entire topic. Messages with the same partition key always land in the same partition in the order they were written, but messages across different partitions have no global ordering guarantee. This distinction matters and tends to surprise engineers who assumed Kafka preserved insertion order globally.
RabbitMQ guarantees ordering within a single queue with a single consumer. The queue preserves insertion order and delivers messages in that order. The moment you add a second consumer, ordering breaks, because Consumer A might acknowledge message 3 before Consumer B acknowledges message 2, and the effective processing order is now determined by consumer speed rather than message arrival time. For email dispatch or PDF generation where processing order is irrelevant, this is fine. For any workload where event sequence matters, competing consumers in RabbitMQ is a trap that works correctly in development, where load is low and timing is forgiving, and breaks in production, where load is real and timing is not.
Kafka guarantees ordering within a partition for any number of consumer groups. Messages with the same partition key always land in the same partition, always in the order they were written. Multiple consumer groups reading the same partition each see the messages in the same order. The constraint is that within a consumer group, one consumer handles one partition at a time, so parallelism within a group is bounded by partition count. For payment events where all transactions for a given account must be processed in sequence, Kafka with account ID as the partition key is the correct answer. The ordering guarantee does not degrade under load or with multiple readers.
The hybrid architecture and when it is not a cop-out
A legitimate production pattern uses both systems for different purposes. Kafka handles the event log between major domains: the payment service publishes a payment.completed event to Kafka, and every downstream system that cares about payments consumes it independently at its own pace. RabbitMQ handles operational work within a domain: the notification service consumes the Kafka event and puts an email dispatch job onto a RabbitMQ queue, where one of its worker instances picks it up, sends the email, and acknowledges the message.
This is not hedging. Each tool is doing the thing it is actually good at. Kafka provides the durable, replayable event history that lets any service reconstruct what happened. RabbitMQ provides the reliable task dispatch that ensures exactly one worker sends each email without duplicates. The failure modes are now separated: consumer lag in Kafka affects how quickly downstream services learn about payments, and queue depth in RabbitMQ affects how quickly notifications go out, and neither failure cascades into the other.
The architecture is more complex to operate than either system alone. That is the trade-off. The question is whether that operational complexity is cheaper than the alternative, which is forcing one system to do both jobs and accepting its failure mode for both workloads.
Applying the four questions before you commit
Before choosing between Kafka and RabbitMQ for a specific use case, run the four questions explicitly.
What are you optimising for? If the answer is throughput, event history, and multiple independent consumers, Kafka. If the answer is reliable delivery of individual tasks to one worker with flexible routing and built-in failure handling, RabbitMQ.
What are you sacrificing? With Kafka: per-message latency, operational simplicity, and consumers that can keep up with producers without active monitoring. With RabbitMQ: event history, replay capability, and ordering under concurrent consumers.
What breaks first? With Kafka: consumer lag when producers outpace consumers, rebalances under rolling deployments, and silent data loss if lag exceeds retention. With RabbitMQ: memory pressure under backpressure, latency spikes from disk paging at high queue depths, and processing stalls from misconfigured prefetch.
How do you recover? With Kafka: add consumers up to partition count, then repartition with a rebalance. With RabbitMQ: add consumers with no repartitioning required, fix prefetch configuration, and scale broker memory if the queue depth problem is structural.
Kafka asks: what happened, and who still needs to know? RabbitMQ asks: who is responsible for doing this work right now? Those are different questions. If you choose the system whose question does not match your problem, you will spend a significant amount of time and engineering effort building the thing the other system gives you for free.
Next in this series: SQL vs NoSQL: The Decision You Cannot Undo and the Failure Mode Nobody Mentions in the Interview
If distributed systems and backend architecture are what you spend your reading time on, the Rust field guide is also available.
$7 — Zero to Rust: A Systems Programmer’s Field Guide
You can read the free sample here — Free 20-page sample


