๐Key Takeaways
- 1Kafka: distributed commit log, highest throughput (millions msg/sec), persistent, best for event streaming
- 2RabbitMQ: traditional message broker, flexible routing, best for task queues and request-reply
- 3SQS/SNS: AWS managed, zero ops, SQS for queues, SNS for pub/sub fan-out
- 4Choose Kafka for event-driven streaming; RabbitMQ for complex routing; SQS for simplicity
Choosing the Right Message Queue
The message queue landscape has distinct categories: Kafka-like distributed logs for high-throughput event streaming, traditional message brokers (RabbitMQ) for flexible routing and task processing, and managed cloud services (SQS/SNS) for operational simplicity.
Message Queue Comparison
| Feature | Kafka | RabbitMQ | SQS | Redis Streams |
|---|---|---|---|---|
| Model | Distributed log | Message broker | Managed queue | In-memory stream |
| Throughput | Millions msg/sec | ~50K msg/sec | ~3K msg/sec per queue | ~100K msg/sec |
| Ordering | Per-partition | Per-queue | Best effort (FIFO available) | Per-stream |
| Persistence | Disk (configurable retention) | Disk + memory | Managed (14 days) | Memory + AOF |
| Consumer model | Pull (consumer groups) | Push + Pull | Pull (long polling) | Pull (consumer groups) |
| Replay | Yes (offset rewind) | No | No (DLQ only) | Yes (by ID) |
| Best for | Event streaming, log aggregation | Task queues, routing | Simple queuing, AWS | Lightweight streaming |
๐กDecision Guide
Need event streaming with replay? โ Kafka. Need complex routing (headers, topics, exchanges)? โ RabbitMQ. Need zero-ops on AWS? โ SQS + SNS. Need lightweight streaming with sub-ms latency? โ Redis Streams.
Advantages
- โขKafka scales to millions of messages/sec
- โขRabbitMQ offers the most flexible routing
- โขSQS requires zero operational overhead
Disadvantages
- โขKafka is complex to operate
- โขRabbitMQ doesn't support message replay
- โขSQS has limited throughput per queue
๐งช Test Your Understanding
Knowledge Check1/1
Which message system supports replaying messages from a past offset?