Blog >

Message Queue Architecture: Kafka vs SQS vs RabbitMQ

Posted by Hadi @draft1 | October 8, 2026

Message Queue Architecture: Kafka vs SQS vs RabbitMQ

Choosing between Kafka, SQS, and RabbitMQ comes down to throughput needs, ordering guarantees, operational appetite, and whether you need event replay. This article breaks down how each system actually works under the hood, where they fit in real message queue architecture, and when picking the "popular" option (usually Kafka) is actually the wrong call.

Every distributed system eventually needs to decouple producers from consumers — a checkout service shouldn't block on an email service, and a fleet of IoT sensors shouldn't care whether your analytics pipeline is up. The question isn't whether to use a message broker, it's which one. Teams often default to Kafka because it's the industry darling, but Amazon SQS and RabbitMQ solve real problems that Kafka handles poorly, and vice versa. By the end of this article you'll know which trade-offs matter for your workload and how to justify the choice to your team.

What Problem Are You Actually Solving?

Message queue architecture exists to decouple producers and consumers in time, space, and failure domain — but the three major tools (Kafka, SQS, RabbitMQ) optimize for different points on the throughput/ordering/complexity spectrum. Before comparing features, separate your requirement into one of three buckets: task distribution (one job, one worker), event streaming (many consumers replaying a log), or flexible routing (complex topologies with priorities, delays, dead-lettering).

  • Task distribution: "Resize this image," "send this email," "charge this card." You want exactly one worker to pick up each job, with retries and visibility timeouts. This is the classic queue model.
  • Event streaming: "Order placed," "inventory updated," "click occurred." Multiple independent consumers (fraud detection, analytics, recommendations) all need to see every event, possibly re-reading history. This is the log model.
  • Flexible routing: "Route orders over $10,000 to the fraud team queue with a 5-minute delay, everything else to standard processing." This needs rich exchange/binding logic.

Kafka is built for the second bucket, SQS for the first, and RabbitMQ sits comfortably in both the first and third. Picking based on popularity instead of this mapping is the most common architecture mistake teams make.

Apache Kafka: The Distributed Log

Kafka isn't really a "queue" — it's a distributed, partitioned, replicated commit log, and that distinction drives every architectural decision downstream. Messages are appended to partitions within a topic, retained for a configurable period (or indefinitely with compaction), and consumers track their own position (offset) rather than the broker deleting messages on acknowledgment.

This log-based model gives you replay: a new consumer group can start from offset zero and reprocess a year of events, which is impossible in a traditional queue where messages vanish once consumed. It also gives you high throughput — Kafka brokers do sequential disk writes and rely on OS page cache, routinely sustaining hundreds of MB/s per broker, and partitioning lets you scale consumers horizontally (up to one consumer per partition within a consumer group).

The trade-offs are real. Kafka requires an ecosystem: brokers, (historically ZooKeeper, now KRaft mode since Kafka 3.3+ which removes the ZooKeeper dependency), partition rebalancing, and careful capacity planning for retention and replication factor (typically 3). Ordering is only guaranteed within a partition, not across a topic — if you need strict global ordering you're stuck with a single partition, which caps your parallelism. Managed options like Amazon MSK (Managed Streaming for Apache Kafka) and Confluent Cloud reduce operational burden significantly but don't eliminate the need to understand partitioning, consumer group rebalancing, and retention tuning.

Kafka shines for: event sourcing, CDC (change data capture) pipelines via Debezium, clickstream/telemetry ingestion, metrics pipelines, and any case where multiple independent teams need to consume the same event stream without the producer knowing or caring who's listening.

Amazon SQS: The Managed Queue That Just Works

Amazon SQS is a fully managed, serverless point-to-point queue service with no brokers to patch, no partitions to plan, and virtually no operational overhead — you create a queue via API or console and start sending messages within minutes. It comes in two flavors: Standard queues (at-least-once delivery, best-effort ordering, nearly unlimited throughput) and FIFO queues (exactly-once processing, strict ordering per message group ID, capped at 3,000 messages/second with batching, 300/sec without).

SQS's core primitive is the visibility timeout: when a consumer polls a message, it becomes invisible to other consumers for a configured period (default 30 seconds, max 12 hours). If the consumer crashes before deleting the message, it reappears for another worker to pick up — this is what makes SQS excellent for task distribution with built-in retry semantics, no extra code required. Pair it with a dead-letter queue (DLQ) and a maxReceiveCount policy, and you get automatic poison-message handling for free.

What SQS doesn't give you: replay. Once a message is deleted (or expires after its retention period, max 14 days), it's gone. There's no concept of multiple independent consumer groups reading the same stream at different speeds — if you need five different services to see every order event, you either fan out with Amazon SNS (SNS topic → multiple SQS queues, the classic "fan-out" pattern) or use EventBridge. SQS also charges per request (per million API calls, with long polling reducing empty-receive costs), so very high-throughput, long-retention use cases can get expensive compared to Kafka's storage-based cost model.

SQS shines for: serverless architectures (Lambda triggers directly off SQS), decoupling microservices where order doesn't matter much, background job processing, and any team that doesn't want to own broker infrastructure at all.

RabbitMQ: The Flexible Router

RabbitMQ is a general-purpose message broker built around the AMQP 0-9-1 protocol, where producers publish to exchanges and routing rules (bindings) determine which queues receive the message — giving you far richer routing logic than SQS or Kafka offer out of the box.

The exchange types are the key mental model:

  • Direct exchange: routes by exact routing key match (like a simple queue).
  • Topic exchange: routes by wildcard pattern matching (orders.*.eu matches orders.created.eu).
  • Fanout exchange: broadcasts to every bound queue, no routing key needed.
  • Headers exchange: routes based on message header attributes instead of routing key.

This makes RabbitMQ excellent for complex workflows: priority queues, per-message TTL, delayed delivery (via the delayed-message plugin or dead-lettering with TTL), and RPC-style request/reply patterns over AMQP. It supports quorum queues (Raft-based replication, replacing the older mirrored queues since RabbitMQ 3.8+) for high availability, and clustering across nodes for scale-out.

Operationally, RabbitMQ sits between SQS and Kafka in complexity. You manage the broker (or use a managed offering like Amazon MQ for RabbitMQ, CloudAMQP, or self-hosted on EC2/Kubernetes), but it's a single binary with a mature management UI and doesn't require the partition-planning discipline Kafka demands. Throughput is lower than Kafka's — RabbitMQ typically handles tens of thousands of messages/second per node rather than Kafka's hundreds of thousands to millions aggregate, because it does more per-message work (routing decisions, optional persistence to disk per message, acknowledgment tracking) rather than Kafka's bulk sequential log writes.

RabbitMQ shines for: traditional enterprise messaging, task queues with complex routing (priority, delay, retry topology), RPC patterns, and teams already comfortable with AMQP who don't need Kafka-scale throughput or replay.

Comparison Table: Kafka vs SQS vs RabbitMQ

Dimension Kafka Amazon SQS RabbitMQ
Model Distributed log Managed point-to-point queue Exchange/queue broker (AMQP)
Ordering Per-partition only FIFO queue: per group ID Per-queue, FIFO by default
Replay Yes, by offset reset No No (without plugins)
Max throughput Very high (MB/s per broker) High (Standard: near-unlimited) Moderate (per-node limited)
Ops burden High (or MSK to offload) None (serverless) Medium (or Amazon MQ)

Delivery Guarantees and Ordering in Practice

None of these systems give you "exactly-once" delivery for free in the way marketing materials imply — all three require you to design for at-least-once semantics with idempotent consumers. Kafka's "exactly-once semantics" (EOS, via idempotent producers and transactional APIs) only holds within the Kafka-to-Kafka pipeline; once you write to an external system (a database, an API call), you're back to at-least-once plus your own idempotency key. SQS Standard queues are explicitly at-least-once and can occasionally deliver duplicates or slightly out-of-order messages under failure conditions; SQS FIFO queues reduce this risk substantially but cap throughput. RabbitMQ with manual acknowledgments is at-least-once by default; auto-ack mode trades reliability for speed and can lose messages on consumer crash.

The practical implication for message queue architecture: build consumers that can safely process the same message twice. Use a database unique constraint, an idempotency token, or a processed-message ledger. This is cheaper than chasing exactly-once guarantees that don't actually extend past the broker boundary.

Kafka vs SQS: The Comparison Everyone Actually Searches For

Since this is the comparison most teams actually need to make, it deserves direct treatment: choose SQS when you want zero operational overhead and simple task distribution, choose Kafka when you need event replay, multiple independent consumer groups, or very high sustained throughput with long retention.

Concretely:

  • If you're running Lambda-based serverless pipelines and just need "do this job, retry if it fails," SQS is less code, less infrastructure, and cheaper at low-to-medium volume.
  • If you need five teams to independently consume the same order-events stream at their own pace, with the ability to reprocess the last 30 days after a bug fix, Kafka (or MSK) is the only one of the two that supports it natively — SQS would require SNS fan-out plus per-consumer queues, and even then there's no replay once messages are deleted.
  • If your volume is enormous and sustained (millions of events/sec, telemetry, CDC streams), Kafka's log-structured storage and partition-based parallelism are typically more cost-efficient than million-plus SQS API calls, though you must now own broker capacity planning (or pay for MSK provisioned/serverless pricing).
  • If your team has no Kafka experience and no SRE bandwidth to learn partition rebalancing, consumer lag monitoring, and ISR (in-sync replica) semantics, the "best" architecture on paper (Kafka) can easily become the worst architecture in production because of operational risk.

A common middle path: use SQS (or EventBridge) for service-to-service task handoff and reserve Kafka for the handful of genuinely high-fan-out, replay-needed event streams — most systems don't need everything to be a Kafka topic.

Architecture Patterns in AWS

A few patterns recur often enough to call out specifically.

Fan-out with SNS + SQS: an SNS topic publishes once, multiple SQS queues subscribe, each downstream service gets its own queue with its own visibility timeout and DLQ. This is the AWS-native way to get "multiple consumers" semantics without Kafka, though it still lacks replay.

EventBridge for routing: Amazon EventBridge adds content-based filtering and a schema registry on top of pub/sub, useful when routing rules depend on event payload content rather than just topic name — think of it as AWS's answer to RabbitMQ's topic exchange, but serverless and integrated with 200+ AWS service sources and SaaS partners.

MSK Serverless or Kafka on EKS: for teams committed to Kafka, MSK Serverless removes partition/broker capacity planning (you're billed per throughput and storage) at a cost premium over self-managed MSK provisioned clusters; self-hosting on EKS gives maximum control but puts broker upgrades, partition rebalancing, and ZooKeeper/KRaft migration squarely on your team.

Amazon MQ for RabbitMQ: if you're migrating an existing on-prem RabbitMQ or ActiveMQ workload to AWS and don't want to rewrite AMQP-dependent code, Amazon MQ gives you a managed broker with the same wire protocol rather than forcing a rearchitecture to SQS's API.

Key Takeaways

  • Kafka is a distributed log optimized for replay, high throughput, and multiple independent consumer groups — not a traditional queue.
  • SQS is the lowest-operational-overhead choice for point-to-point task distribution, especially in serverless architectures, but offers no replay and FIFO queues cap throughput at 3,000 msg/sec.
  • RabbitMQ offers the richest routing logic (direct, topic, fanout, headers exchanges) and sits in operational complexity between SQS and Kafka.
  • All three are at-least-once by default in practice — design idempotent consumers rather than relying on "exactly-once" marketing claims.
  • Kafka vs SQS decisions usually come down to replay and fan-out needs versus operational simplicity and cost at low-to-medium volume.
  • Managed variants (MSK, MSK Serverless, Amazon MQ) reduce but don't eliminate the conceptual overhead of partitions (Kafka) or exchanges/bindings (RabbitMQ).
  • Most systems don't need everything on Kafka — mixing SQS/EventBridge for task handoff and Kafka for genuine high-fan-out streams is a common and sound pattern.

Frequently Asked Questions

Is Kafka faster than SQS?

Kafka generally supports higher sustained aggregate throughput per cluster because of sequential disk writes and partition-based parallelism, often handling hundreds of thousands to millions of messages/second across a cluster. SQS Standard queues scale nearly unlimited too, but each API call carries [network](https://www.draft1.ai/blog/zero-trust-network-architecture-explained)/request overhead, so for very high and sustained volumes, Kafka is usually more throughput- and cost-efficient; for bursty or moderate workloads, SQS's serverless model is simpler and fast enough.

Can SQS replace Kafka?

Not for use cases that require event replay or multiple independent consumer groups reading the same stream — SQS deletes messages once processed and has no offset concept. For simple task distribution and service decoupling, SQS is often a better fit than Kafka because it requires no broker management.

Does RabbitMQ support exactly-once delivery?

No, RabbitMQ provides at-least-once delivery with manual acknowledgments (or at-most-once with auto-ack), not exactly-once. Like Kafka and SQS, true end-to-end exactly-once semantics require idempotent consumer logic on top of the broker's guarantees.

What is the difference between SQS Standard and FIFO queues?

SQS Standard queues offer best-effort ordering and at-least-once delivery with near-unlimited throughput, while FIFO queues guarantee strict ordering per message group ID and exactly-once processing within a 5-minute deduplication window, capped at 3,000 messages/second with batching. Choose FIFO only when ordering or deduplication correctness matters more than raw throughput.

Is Kafka overkill for a small microservices app?

Often yes — if you have a handful of services passing background jobs around without needing replay or massive throughput, Kafka's operational overhead (partition planning, consumer group rebalancing, broker capacity) usually outweighs its benefits. SQS or RabbitMQ typically gets the job done with far less infrastructure to maintain.

How does Amazon MSK compare to self-managed Kafka?

Amazon MSK handles broker provisioning, patching, and replication, and MSK Serverless additionally removes partition/throughput capacity planning, both at a cost premium over self-hosting. Self-managed Kafka (on EC2 or Kubernetes) gives full control over tuning and version upgrades but requires in-house expertise in KRaft/ZooKeeper, partition rebalancing, and broker scaling.

Which is cheapest at small scale: Kafka, SQS, or RabbitMQ?

SQS is usually cheapest at low-to-moderate volume since there's no idle broker cost — you pay per request with a generous free tier historically offered by AWS. Kafka (even via MSK) and RabbitMQ (even via Amazon MQ) incur baseline broker/instance costs regardless of traffic, making them comparatively more expensive for low, spiky workloads.


Draw this in seconds with draft1. Describe your architecture in plain English and draft1 generates an editable AWS/cloud diagram plus documentation — no dragging boxes around. Try it free.

Draw this in ~20 seconds

Describe your own version of this architecture and draft1 generates an editable draw.io diagram — boxes, arrows, labels, the lot.

Generate this diagram free ➔

Free demo — no signup. Then 3 free diagrams with an account, no card.