Celery is the most widely used task queue in the Python world, especially with Django and Flask. It moves slow work (emails, reports, image processing, API calls, imports) out of web requests and into background workers. Running Celery well on a VPS is mostly about choosing sensible settings, because the defaults favour throughput over safety in a few important places.
How Celery Fits Together
web app ─▶ broker (Redis or RabbitMQ) ─▶ workers ─▶ result backend (optional)
▲
celery beat (one instance) schedules periodic tasks
For general patterns of background processing, see our background workers guide.
Choosing a Broker
| Broker | Strengths | Watch out for |
|---|---|---|
| Redis | Simple, fast, often already in your stack | Visibility timeout behaviour for long tasks; configure persistence and memory policy |
| RabbitMQ | Mature acknowledgements, routing and durability features | Another service to operate; see our RabbitMQ guide |
With Redis, tasks that are not acknowledged within the visibility timeout can be redelivered to another worker. Set the timeout longer than your longest task, especially when using late acknowledgement and ETA or countdown tasks. Configure Redis so it never evicts broker keys (see our Redis guide).
Concurrency Pools
- prefork (default): multiple processes; best for CPU-bound tasks; set concurrency near the vCore count.
- threads, gevent or eventlet: many concurrent I/O-bound tasks (API calls, sending messages) in fewer processes.
- Run separate worker groups for CPU and I/O tasks, each with a suitable pool.
Separate Queues
Route tasks to queues by type and priority, such as default, emails, reports and heavy, and start workers that consume specific queues. A big report job then never delays password reset emails. Keep the number of queues small and meaningful.
Acknowledgement, Prefetch and Idempotency
By default, Celery acknowledges a task when a worker receives it, so a crash mid-task loses it. For important tasks, enable acks_late so the task is acknowledged after completion, accepting that it may run twice after a crash. That makes idempotency essential: design tasks so a second run does no harm (check whether the email was already sent, use unique constraints, record processed IDs). Lower the prefetch multiplier (for example to 1) for long tasks, so one worker does not reserve many tasks while others sit idle.
Retries and Time Limits
- Use automatic retries for transient errors, with exponential backoff and a maximum number of attempts.
- Do not retry permanent errors such as invalid input.
- Set a soft time limit (raises an exception the task can handle) and a hard time limit (kills the process) for every task type.
- Record failures with enough context to debug, and alert on growing failure rates.
Memory Management
Long-running worker processes can grow in memory due to leaks in libraries or large data. Set worker_max_tasks_per_child or worker_max_memory_per_child so processes are replaced periodically. Pass IDs rather than large objects as task arguments, and load data inside the task.
Periodic Tasks with Celery Beat
Celery beat sends periodic tasks according to a schedule. Run exactly one beat instance, or tasks will be scheduled twice. With Django, the database-backed scheduler lets you manage schedules in the admin. Make periodic tasks idempotent too, because a restart near a scheduled time can cause duplicates or skips.
Results
Many tasks do not need stored results. Disable result storage by default and enable it only where callers need the outcome, with expiry times, so the result backend does not grow forever.
Running Workers
Run each worker group as a systemd service (or a container) with automatic restart, environment variables from a protected file, and logs to the journal or a log collector. On deploy, restart workers gracefully so they finish current tasks: Celery's warm shutdown waits for running tasks. Make sure task code changes stay compatible with tasks already in the queue. See our Django deployment guide for the web side.
Monitoring
Flower provides a web dashboard of workers, tasks and queues; keep it behind authentication and a private network. Export metrics for queue length, task rates, durations and failures to your monitoring system, and alert when queues keep growing or workers disappear (see our monitoring guide).
Sizing
| Workload | Suggested plan |
|---|---|
| Emails, notifications, API calls | 2 vCores / 8 GB with thread or gevent pools |
| Reports, exports, image processing | 4 vCores / 16 GB with prefork |
| Heavy data or ML preprocessing | 8 vCores / 32 GB, or dedicated worker servers |
Workers can live on the web server for small apps; move them to their own VPS when they compete with web traffic for CPU.
Example: An E-Commerce Django App
A Django store uses Redis as broker on a 4 vCore / 16 GB VPS. One worker group with a thread pool handles emails and webhooks; another prefork group with four processes generates invoices and exports. Important tasks use late acknowledgement and idempotency keys, each child process is recycled after 500 tasks, a single beat service runs nightly reports, and Flower is reachable only over VPN.
Common Mistakes
- Running two beat schedulers.
- Default early acknowledgement for critical tasks.
- Redis visibility timeout shorter than the longest task.
- No time limits, so hung tasks block workers forever.
- Storing every result without expiry.
In Short
Pick Redis or RabbitMQ, separate queues, match pools and concurrency to the work, use late acknowledgement with idempotent tasks, set time limits, recycle processes, run one beat, and monitor.
SkyRainCloud Plans for This Workload
Celery workers scale with your tasks: I/O-heavy tasks fit 2 vCores / 8 GB with high concurrency; CPU-heavy tasks need about one process per vCore, so 4–8 vCores for serious processing.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Intel Xeon Platinum 8269CY VPS
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — Intel | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Business websites, small apps, scheduled jobs and bots | Order |
| VPS 2 — Intel | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| VPS 3 — Intel | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| VPS 4 — Intel | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,299/month | High-memory workloads and consolidated production servers | Check stock |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.