A web request should finish in well under a second. Anything slower, such as sending email, generating PDFs, resizing images, calling flaky third-party APIs or importing large files, belongs in the background. A job queue lets the web process hand off work and respond immediately, while workers process jobs at their own pace, retry failures and survive restarts. This guide shows how to run that reliably on a VPS.
How a Job Queue Works
web request ─▶ enqueue job ─▶ [ queue: Redis / RabbitMQ / database ]
│
worker 1 ◀────┼────▶ worker 2 (process, ack, retry on failure)
▼
failed-jobs list for inspection
The queue stores jobs durably; workers take jobs, run them and acknowledge success. If a worker crashes mid-job, the job becomes available again (depending on the system's acknowledgement settings), so it is not lost.
Step 1: Choose a Queue Backend
| Backend | Good for | Notes |
|---|---|---|
| Redis | Most web apps; used by BullMQ, Sidekiq, RQ, Laravel, Celery | Fast and simple; enable persistence so queued jobs survive restarts |
| RabbitMQ | Complex routing, many consumers, strict delivery guarantees | More features and more to operate |
| Database (PostgreSQL/MySQL) | Low volume, fewest moving parts | Laravel's database driver, or Postgres-based queues; adds load to the database |
Start with what your framework supports best. For Redis, keep it on localhost with a password and persistence configured (see our Redis guide); a cache-only Redis with an eviction policy is not suitable for queues, because it can evict jobs.
Step 2: Run Workers as Services
Workers must start on boot and restart after crashes. A systemd template unit lets you run several identical workers:
# /etc/systemd/system/worker@.service
[Unit]
Description=Queue worker %i
After=network.target redis-server.service
[Service]
User=app
WorkingDirectory=/srv/app/current
EnvironmentFile=/etc/app/env
ExecStart=/srv/app/current/bin/worker
Restart=always
RestartSec=5
KillSignal=SIGTERM
TimeoutStopSec=120
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now worker@1 worker@2
journalctl -u 'worker@*' -f
bin/worker is your framework's worker command, for example celery -A app worker, php artisan queue:work, bundle exec sidekiq or node worker.js. TimeoutStopSec gives running jobs time to finish when the service stops. In Docker, run workers as separate services in the Compose file with restart: unless-stopped and a stop_grace_period.
Step 3: Concurrency and Resources
- CPU-bound jobs (image processing, PDFs, data crunching): about one concurrent job per vCore.
- I/O-bound jobs (HTTP calls, email): higher concurrency per worker, limited by memory and by rate limits of the services you call.
- Memory: measure one worker under load and multiply by the number of workers; leave room for the web app and database.
- Separate queues for fast and slow jobs, so a batch of reports cannot delay password-reset emails.
- Restart workers periodically (many libraries support a max jobs or max memory setting) to contain slow memory leaks.
Step 4: Retries, Idempotency and Failures
- Retries with backoff: retry transient failures a few times with increasing delays.
- Idempotency: design jobs so running them twice is safe, because at-least-once delivery means duplicates can happen. Check whether the email was already sent or the payment already recorded before acting.
- Timeouts: set a maximum run time per job so a stuck job cannot block a worker forever.
- Failed jobs: keep them in a failed list or dead-letter queue, alert on them and make them easy to inspect and retry.
- Small payloads: pass IDs, not whole objects, and load fresh data in the job.
Step 5: Scheduled Jobs
Recurring work, such as nightly reports or cleanup, can be triggered by cron or systemd timers that enqueue a job, or by your framework's scheduler (Laravel's scheduler, Celery beat, BullMQ repeatable jobs). Run exactly one scheduler instance, even with many workers or servers, or jobs will run multiple times (see our cron guide).
Step 6: Deploys Without Losing Jobs
- Deploy the new code.
- Send workers a graceful stop signal (
SIGTERM); they finish the current job and exit. - systemd or Docker starts workers on the new code.
Restart workers on every deploy, otherwise they keep running old code. Keep job payloads backward compatible, because jobs queued by the old version will be processed by the new one. Our zero-downtime deployment guide covers the web side.
Step 7: Monitor the Queue
| Metric | Why it matters |
|---|---|
| Queue length | Growing steadily means workers cannot keep up |
| Oldest job age | How late work is running, as users experience it |
| Failed jobs per hour | Bugs or failing dependencies |
| Worker restarts | Crashes or memory problems |
| Job duration | Slowdowns in external services or the database |
Many queue libraries offer dashboards (Flower for Celery, Bull Board for BullMQ, Horizon for Laravel, Sidekiq's web UI); keep them behind authentication. Alert on queue age and failures (see our monitoring guide).
When to Give Workers Their Own Server
Move workers to a separate VPS when background jobs compete with web requests for CPU or memory, or when jobs need lots of resources at once. Workers connect to the same Redis or RabbitMQ over a private network or an encrypted connection; nothing else changes.
SkyRainCloud Plans for This Workload
Workers are sized by concurrency: each worker process or thread needs memory, and CPU-heavy jobs need a core each. A 4 vCore / 16 GB server runs a web app plus a handful of workers; move heavy job processing to its own VPS as volume grows.
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.