« All posts

Kafka vs RabbitMQ: You're Asking the Wrong Question

Choosing Kafka vs RabbitMQ isn't about throughput benchmarks. The real question is queue vs log, and whether you need message replay and multiple consumers.

One of the most frequently asked, and poorly answered, backend engineering questions is whether to use Kafka or RabbitMQ. Most discussions collapse into throughput benchmarking, but the real decision hinges on what each system fundamentally is: RabbitMQ is a queue that delivers a message and forgets it, while Kafka is a log that stores messages and lets you replay them later.

RabbitMQ is a classic broker built around exchanges and acknowledgments, where each message represents a one-time task consumed by a single worker, such as resizing an image or sending an email. Kafka, by contrast, is an append-only commit log where messages persist across a retention window and each consumer group tracks its own offset independently. The clearest illustration is replay: if a bug corrupts an analytics consumer, Kafka lets you reset the offset and reprocess yesterday's events, while in RabbitMQ those acknowledged messages are gone for good.

The piece argues that throughput numbers are a consequence of the architectural choice, not the choice itself, and offers a simple decision framework: if a message is a one-off task for a single worker, pick RabbitMQ; if it's an event multiple systems may need now or later, or you need to replay history, pick Kafka. It's entirely normal to run both in the same system, RabbitMQ for command-style task queues and Kafka as the event backbone, since the real mistake is forcing whichever tool you already know into every use case.