Blogs

How to Choose a Celery Broker: Redis vs RabbitMQ vs SQS

  • Celery
  • Task Queues
  • Redis
  • Python
Dark graphic titled Pick a Celery broker comparing RabbitMQ, Redis and Amazon SQS, with a Celery config snippet highlighting the Redis broker URL and visibility_timeout

In short: Choose RabbitMQ for a Celery broker unless you have a reason not to: it is Celery’s default and supports monitoring and remote control. Choose Redis if you already run it and your tasks are short with small payloads, and set the visibility timeout above your longest ETA. Choose Amazon SQS on AWS when zero servers matters more than Flower, events and remote control, which SQS does not support.

Choosing a Celery broker comes down to three questions: what you already run, how long your tasks wait before they run, and whether you need to see inside the queue. Celery supports RabbitMQ, Redis and Amazon SQS as stable brokers, and each one fails in a different way when you pick it for the wrong job.

My short answer: RabbitMQ is the safe default, Redis is fine for short tasks once you tune two settings, and SQS is the right call on AWS when you want no broker servers at all and can live without monitoring.

You’ll learn:

  • A decision table that picks a Celery broker in under a minute
  • The RabbitMQ features that make it the default, and the quorum queue caveats
  • The Redis visibility timeout trap and the two settings that prevent it
  • What you give up with Amazon SQS
  • Working configuration for each broker

Which Celery broker should I use?

Use the first row in this table that matches your situation. It compresses the Celery docs’ broker pages and the failure modes they warn about.

Your situationBrokerWhy
No strong preference, or you need monitoring with FlowerRabbitMQCelery’s default broker, full monitoring and remote control
You already run Redis, tasks are short, payloads are smallRedisOne less service to run; fast for small messages
Tasks scheduled hours ahead (long ETA or countdown)RabbitMQRedis and SQS redeliver tasks that wait longer than the visibility timeout
Large payloads (big JSON, documents)RabbitMQ, or pass a referenceRedis docs warn large messages can congest the system
You are on AWS and want no broker serversAmazon SQSFully managed; accept no Flower, no events, no remote control
Very high message ratesRedis or SQSThe Celery docs suggest these unless RabbitMQ runs at very large scale

Celery’s own comparison table marks RabbitMQ, Redis and SQS as stable. RabbitMQ and Redis support monitoring and remote control; SQS supports neither. Kafka, Zookeeper and Google Pub/Sub are listed as experimental, which the docs define as functional but without dedicated maintainers. I would not put them under a production queue.

When is RabbitMQ the right Celery broker?

RabbitMQ is the right broker when you want the fewest surprises. It is Celery’s default, so it needs no extra dependencies, and it supports everything Celery can do: events for Flower, celery inspect, celery control and long ETAs without redelivery loops.

The cost is running another service. If you use quorum queues (supported since Celery 5.5) for durability, read the caveats first. Quorum queues require disabling global QoS, so autoscaling does not work, and ETA or countdown tasks switch to RabbitMQ native delayed delivery. From RabbitMQ 4.0, quorum queues also default to a delivery limit of 20, after which a message that keeps failing is dropped or dead-lettered.

When is Redis the right Celery broker?

Redis is the right broker when you already run it and your tasks are short. Celery’s docs put it plainly: Redis “works well for rapid transport of small messages. Large messages can congest the system.”

The trap is the visibility timeout. Redis does not have real acknowledgements, so Celery hides a fetched task for a fixed time and redelivers it if no worker acknowledges it in time. The default is one hour. A task with an ETA or countdown longer than that, or a retry scheduled further out, gets delivered to a second worker, and as the docs warn, it “will be executed again, and again in a loop.”

Two settings prevent most Redis broker incidents:

  1. Keep ETAs below the visibility timeout, or raise the timeout (it must be set on the broker, the result backend and visibility_timeout, and the shortest value wins if several apps share the broker). The docs recommend against raising it very high, because it delays redelivery after a worker crashes.
  2. Stop Redis from evicting broker keys. Set maxmemory-policy to noeviction (or allkeys-lru on a dedicated broker), and turn on appendonly yes with appendfsync everysec so a restart loses at most about a second of tasks instead of everything since the last snapshot.

I cover the rest of the Redis-specific surprises in Celery + Redis Gotchas Nobody Warns You About.

When is Amazon SQS the right Celery broker?

SQS is the right broker when you are on AWS and want no broker servers to patch, scale or back up. You pay for that with features: Celery’s docs state that SQS does not support worker remote control commands or events, so Flower, celery events and celery inspect do not work.

Other things to know before choosing it:

  • Visibility timeout defaults to 30 minutes, and the same redelivery loop applies to long ETAs. The AWS maximum is 12 hours, so anything scheduled further ahead belongs in a database-backed scheduler.
  • Long polling is on by default with a 10 second wait, which keeps idle costs and empty receives down.
  • No result backend. Celery ships no SQS result backend, so store results in Redis, a database or not at all.
  • FIFO queues need MessageGroupId and sometimes MessageDeduplicationId, passed through apply_async().

Configuration for each broker

These are minimal configurations taken from the Celery 5.7 docs. I did not run them against live brokers for this post; they are the starting points I use, with the values the docs document.

# RabbitMQ: the default, nothing special needed
app = Celery("tasks", broker="amqp://user:password@rabbitmq:5672//")

# Redis: keep the longest ETA below the visibility timeout (seconds)
app = Celery("tasks", broker="redis://redis:6379/0")
app.conf.broker_transport_options = {"visibility_timeout": 3600}

# Amazon SQS: credentials from the environment or an IAM role
app = Celery("tasks", broker="sqs://")
app.conf.broker_transport_options = {
    "region": "eu-west-1",
    "visibility_timeout": 3600,   # longer than your longest task or ETA
    "wait_time_seconds": 10,      # long polling
}

Whichever broker you choose, make tasks safe to run twice. Every broker here can redeliver a task, and idempotent Celery tasks turn a duplicate delivery into a no-op instead of a double charge. Pair that with retries, backoff and a dead-letter queue so failures end somewhere you can see them.

My default

Start with RabbitMQ unless you already run Redis and your tasks are short, in which case Redis with noeviction, AOF and a visibility timeout above your longest ETA is fine. Move to SQS only when running a broker is the real cost and you accept losing Flower and remote control. If you are still choosing the task queue itself, the Python task queue comparison covers Celery against Dramatiq, RQ and arq.

Sources

Related reading

Frequently asked questions

Is Redis good enough as a Celery broker in production?
Yes, for short tasks with small payloads, if you configure it: set maxmemory-policy to noeviction, turn on AOF persistence, and keep every ETA or countdown shorter than the visibility timeout (1 hour by default), or the task runs again.
Does Flower work with Amazon SQS?
No. Celery’s docs list SQS with no monitoring and no remote control support, so Flower, celery events and celery inspect do not work against an SQS broker.
Should I switch my Celery broker from Redis to RabbitMQ?
Only if Redis is causing a real problem: duplicate runs from long ETAs, large messages congesting it, or evicted keys. If your tasks are short and Redis is configured correctly, switching buys you little.

Tell me about your next project

Have an AI agent, a backend or a full product in mind? Send a short note and we can talk it through.