Celery
ELI5 — The Vibe Check
Celery is Python's way of saying 'I'll do that later.' When your API gets a request that takes forever — sending emails, processing images, crunching numbers — Celery handles it in the background so your user isn't staring at a spinner. It's the 'I'll get back to you' of backend development.
Real Talk
Celery is a distributed task queue for Python that enables asynchronous job processing. It supports scheduling, retries, rate limiting, and multiple message brokers (Redis, RabbitMQ). Workers process tasks from queues independently, allowing horizontal scaling of background job processing.
Show Me The Code
@celery.task
def send_welcome_email(user_id):
user = User.get(user_id)
mailer.send(user.email, 'Welcome!')
# Dispatch async
send_welcome_email.delay(user.id)
When You'll Hear This
"Push the report generation to Celery so the API responds immediately." / "Our Celery workers process 10,000 background jobs per minute."
Related Terms
Background Job
A background job is work your app does behind the scenes that the user doesn't wait for.
Message Queue
A Message Queue is a waiting room for tasks. Producers drop tasks in the queue, consumers pick them up and process them one at a time.
Redis
Redis is an incredibly fast database that lives entirely in memory (RAM). It's used as a cache, a session store, and a message queue.
Worker
A worker is a background process that picks up jobs from a queue and does the heavy lifting.