Intermediate25 min readยท Topic 5.4

Major message queue systems

Kafka, RabbitMQ, Amazon SQS/SNS, Google Pub/Sub, Redis Streams

๐Ÿ“ŠKey Takeaways

  • 1
    Kafka: distributed commit log, highest throughput (millions msg/sec), persistent, best for event streaming
  • 2
    RabbitMQ: traditional message broker, flexible routing, best for task queues and request-reply
  • 3
    SQS/SNS: AWS managed, zero ops, SQS for queues, SNS for pub/sub fan-out
  • 4
    Choose 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

FeatureKafkaRabbitMQSQSRedis Streams
ModelDistributed logMessage brokerManaged queueIn-memory stream
ThroughputMillions msg/sec~50K msg/sec~3K msg/sec per queue~100K msg/sec
OrderingPer-partitionPer-queueBest effort (FIFO available)Per-stream
PersistenceDisk (configurable retention)Disk + memoryManaged (14 days)Memory + AOF
Consumer modelPull (consumer groups)Push + PullPull (long polling)Pull (consumer groups)
ReplayYes (offset rewind)NoNo (DLQ only)Yes (by ID)
Best forEvent streaming, log aggregationTask queues, routingSimple queuing, AWSLightweight 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?