Side by side
| Dimension | RabbitMQ | SQS |
|---|---|---|
| Operating model | RabbitMQ: self-hosted or managed broker deployments | SQS: AWS-managed regional service |
| Routing and fan-out | Exchanges route to queues using bindings | Queue API; typically add SNS or EventBridge for routing |
| Consumer delivery | Push-style subscriptions with acknowledgments and prefetch | Polling, usually long polling, with visibility timeouts |
| Ordering | FIFO enqueue order; concurrency and redelivery complicate processing order | Standard: best effort; FIFO: ordered within message groups |
| Duplicates | Redelivery and uncertain publishes can produce duplicates | Standard allows duplicates; FIFO adds send deduplication |
| Durability | Configure durable queues, persistent messages, confirms, and replication | Managed redundant storage; no broker replication to configure |
| Scaling | Size brokers and distribute queues; hot queues need planning | Managed capacity subject to API, FIFO, and in-flight quotas |
| Retry behavior | Acknowledgments, rejection, dead-lettering, and configured retry paths | Visibility expiration, visibility extensions, and DLQ redrive policies |
| Cost model | Broker capacity, storage, networking, and operations | Requests, payload size, and applicable transfer charges |
The differences that matter
RabbitMQ combines routing and work distribution: a topic exchange can route an event to several queues based on routing keys and bindings. SQS distributes work within a queue, but does not provide RabbitMQ-style exchanges. For independent subscribers, use separate SQS queues and a fan-out layer such as SNS; multiple consumers on one queue compete for messages rather than each receiving a copy.
Failure recovery works differently. With RabbitMQ manual acknowledgments, an unacknowledged message can be requeued when its channel or connection closes. With SQS, receiving a message temporarily hides it; the worker must delete it after success or it becomes visible again when the visibility timeout expires. Long jobs need visibility extensions in SQS, while RabbitMQ consumers need appropriate prefetch and acknowledgment-timeout settings.
Ordering must be defined at the business-key level. SQS FIFO message groups provide ordered delivery within each group, but workers must preserve processing order within received batches. RabbitMQ queue order alone does not guarantee completion order across parallel consumers or retries. For either choice, explain which jobs may run concurrently and what happens when one ordered job fails.
RabbitMQ gives you more responsibility for capacity and failure handling. A durable setup commonly uses quorum queues, persistent messages, publisher confirms, and manual consumer acknowledgments; the broker fleet still needs sizing, upgrades, and monitoring unless a provider handles them. SQS removes broker management, but quotas, consumer concurrency, visibility settings, and backlog age remain your responsibility.
Neither system closes the transaction boundary between a queue and your database or external provider. A worker can complete a side effect and crash before acknowledging or deleting the message. Use idempotency keys or transactional deduplication, and use an outbox when a database update must reliably produce a message. SQS FIFO deduplication does not make arbitrary consumer side effects exactly once.
Choose RabbitMQ when
- You need broker-side topic, direct, or fan-out routing with independently buffered consumer queues.
- Your deployment must run on premises, outside AWS, or across environments without depending on an AWS queue service.
- You need explicit consumer prefetch and acknowledgment control, and your team can operate or procure a managed RabbitMQ deployment.
- An existing RabbitMQ platform already meets your durability, capacity, and recovery requirements.
Choose SQS when
- Your application runs on AWS and needs durable background work distribution without managing broker nodes.
- Traffic is bursty, and managed queue capacity is preferable to provisioning a broker fleet, subject to service quotas.
- You need per-entity ordered delivery and can map entities to SQS FIFO message groups while preserving processing order.
- Your workers fit a receive, process, delete model, including Lambda-based consumers with carefully configured batch failure handling.
A worked example
Absorbing a notification burst
Assume a notification service receives 2,000 jobs per second for five minutes, while its provider permits only 500 sends per second. The backlog grows by 450,000 jobs during the burst. Either queue can buffer the work if configured and sized appropriately, but workers must enforce the provider limit. SQS Standard is a reasonable AWS choice when ordering is unnecessary and avoiding broker operations matters. RabbitMQ fits when routing keys must direct jobs into independent channel queues and a broker platform already exists. In both designs, use a stable notification ID for deduplication, bounded retries, a DLQ, and backlog-age alerts. Adding workers cannot bypass the provider's limit.
In the interview
- Start with requirements rather than product names: work queue or pub/sub, ordering scope, peak arrival rate, processing duration, retention, and deployment constraints.
- Walk through a worker crash after the database commit but before acknowledgment or deletion. Explain the idempotency mechanism, then expect questions about concurrent duplicate attempts.
- Estimate worker concurrency from arrival rate multiplied by average processing time, then add headroom. Explain backlog-drain capacity and downstream rate limits rather than assuming more consumers always help.
- For RabbitMQ, justify queue type, publisher confirms, prefetch, and broker failure recovery. For SQS, justify Standard versus FIFO, visibility timeout, long polling, and relevant quotas.
- Describe poison-message handling and observability: bounded retries, backoff, a DLQ, oldest-message age, processing failures, and a safe redrive procedure.
Common mistakes
- Claiming SQS FIFO provides exactly-once business processing, or that RabbitMQ acknowledgments prevent duplicate side effects.
- Treating SQS Standard as ordered, or assuming RabbitMQ queue order guarantees completion order with parallel consumers.
- Comparing RabbitMQ exchanges with a single SQS queue without accounting for the SNS or EventBridge layer needed for routing and fan-out.
- Calling SQS infinitely scalable or RabbitMQ automatically durable without discussing quotas, queue topology, replication, and acknowledgment settings.
Where it comes up
Interview questions where choosing between RabbitMQ and SQS comes up.
- Design a distributed message queue like RabbitMQThe comparison exposes the core queue-design choices around acknowledgments, visibility leases, replication, duplicate delivery, and hot queues.
- Design a notification systemQueue selection affects per-channel isolation, fan-out, provider throttling, retries, and duplicate notification prevention.
- Design a video streaming service like YouTubeTranscoding workers need durable job dispatch, bounded concurrency, long-running task recovery, and retry-safe output publication.
- Design a distributed job schedulerDispatching scheduled jobs requires explicit worker ownership, crash recovery, retry handling, and duplicate-execution protection.
- Design Google PhotosAsynchronous image processing needs reliable work distribution, independent processing queues, and idempotent retries.
Questions people ask
Is SQS a replacement for RabbitMQ?
SQS can replace RabbitMQ for many background work queues, but it is not a drop-in protocol or routing replacement. Applications must adapt acknowledgments to visibility timeouts and deletion, and may need SNS or EventBridge for routing and fan-out.
Which is faster, RabbitMQ or SQS?
There is no universal winner: latency depends on network placement, persistence settings, batching, polling, load, and consumer behavior. RabbitMQ supports push-style delivery, while SQS uses receive requests, typically with long polling. Measure end-to-end enqueue-to-completion latency under your required durability settings rather than comparing isolated API calls.
Do RabbitMQ and SQS guarantee exactly-once delivery?
RabbitMQ consumers and SQS Standard consumers must tolerate duplicate delivery. SQS FIFO adds send deduplication and ordered message groups, but a worker can still repeat a side effect after a crash or expired visibility timeout. Exactly-once business outcomes require application-level idempotency or a suitable transactional boundary.