Kafka Vs RabbitMQ

Kafka is more suitable for event streaming, pubsub whereas RabbitMQ is suitable for standard messaging work

Let's assume that both Kafka and RabbitMQ we setup 1 queue to evaluate how they can scale

Loading...

As we can see that with only 1 queue, RabbitMQ only can have 1 worker at a time process the message since they will delete afterwards. If we want to scale multiple worker, we need multiple queue.

FeatureRabbitMQApache Kafka
Best ForBackground tasks & simple microservices.High-speed data streams & event history.
Data RetentionEphemeral: Deleted after it is read.Durable: Stored on disk for days or years.
Throughput~4k – 10k messages per second.1 Million+ messages per second.
Message ReplayNo (Except for modern "Stream Queues").Yes: Native "rewind and replay" ability.
RoutingComplex: High flexibility (headers, keys).Simple: Based on Topics/Partitions.
ModelPush: Broker sends data to you.Pull: You ask the broker for data.
ScalabilityVertical & Horizontal (moderate).Extreme: Massively horizontal via partitions.

Scaling

RabbitMQ scale by adding more node/cluster

Kafka scaling by adding more partition