Skip to the page

Celery and background jobs · Concept

How Celery works

The interviewer asks

Explain how Celery works. What are the broker, the worker and the result backend, and what happens between calling .delay() and the task running?

Then

Follow-ups the interviewer asks next

  1. What exactly is in the message that goes to the broker?
  2. When is the message acknowledged by default?
  3. Do you always need a result backend?
  4. What is prefetching, and why does it matter for long tasks?
  5. How do you see what the workers are doing?

The answer

What a strong answer covers

  • The producer (your web app) serialises the task name and arguments (JSON by default) into a message and publishes it to a queue on the broker: Redis, RabbitMQ or SQS.
  • Workers consume from queues. The default prefork pool runs tasks in child processes; concurrency defaults to the number of CPUs (Celery 5.7 added --concurrency=auto, which reads the container's CPU quota).
  • By default the message is acknowledged when the worker receives it, before the task runs (early ack): a crash mid-task loses it. acks_late=True acknowledges after the task returns, so the task may run twice.
  • Each worker reserves worker_prefetch_multiplier (default 4) times its concurrency in messages. With long tasks, one worker can hold work while others sit idle; use a multiplier of 1 (with acks_late) for them.
  • The result backend (Redis or a database) stores states and return values; you need it for .get(), chords and status checks. Many tasks don't (ignore_result=True).
  • Beat is a separate process that sends scheduled tasks to the broker; it doesn't run them.
  • Watching: Flower, celery inspect active and reserved, queue-length metrics, task events. Versions: Celery 5.6 (Nov 2025) and 5.7 (Nov 2026).

The red pen

Common traps

Avoid:"Celery is a message broker"; thinking tasks run inside the web process; not knowing when the default ack happens.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview