Skip to content

Benchmarks

This page documents the performance characteristics of django-vtasks compared to Celery, a popular task queue for Python.

Methodology

Benchmarks were run using Docker containers with:

  • Valkey 9 as the broker
  • 1000 tasks per scenario
  • Python 3.14

Two task types were tested:

  • NoOp: Tasks that return immediately (measures raw overhead)
  • Sleep: Tasks that sleep for 1ms (measures I/O concurrency)

Results

Scenario Concurrency Enqueue Rate (ops/s) Process Rate (ops/s)
VTasks (Async) - NoOp 200 1,218 250
VTasks (Async) - Sleep 200 1,383 250
VTasks (Async) - Sleep (High Concurrency) 500 1,244 250
Celery (Prefork) - NoOp 8 651 154
Celery (Prefork) - Sleep 8 705 166
Celery (Threads) - NoOp 200 655 166
Celery (Threads) - Sleep 200 644 166

Analysis

Enqueue Performance

django-vtasks achieves approximately 1.9x faster enqueue rates compared to Celery:

  • VTasks: ~1,200-1,400 ops/s
  • Celery: ~650-700 ops/s

This improvement comes from:

  • Async-native enqueue using aenqueue()
  • Efficient Valkey LPUSH operations
  • Minimal serialization overhead with orjson

Processing Performance

django-vtasks achieves approximately 1.5x faster processing rates compared to Celery:

  • VTasks: ~250 ops/s
  • Celery (Threads/Prefork): ~154-166 ops/s

The processing advantage comes from:

  • Native asyncio event loop (no thread pool overhead)
  • Efficient task fetching with BLMOVE
  • Lower per-task overhead

Concurrency Scaling

VTasks maintains consistent throughput across different concurrency levels (200 vs 500), demonstrating efficient resource utilization. The async architecture allows handling many concurrent I/O-bound tasks without proportionally increasing resource usage.

Celery's prefork pool is limited by CPU cores (8 workers in our test), while the thread pool has higher overhead per concurrent task.

Running Benchmarks

To run the benchmarks yourself:

# Start services
docker compose up -d db cache

# Run the comparison benchmark
docker compose run --rm web uv run python benchmarks/compare.py

The benchmark suite includes:

  • benchmarks/compare.py - Comparison between VTasks and Celery
  • benchmarks/run_suite.py - VTasks backend comparison (Postgres vs Valkey)
  • benchmarks/chaos.py - Reliability testing with worker restarts

Notes

  • These benchmarks focus on throughput under ideal conditions
  • Real-world performance depends on task complexity, network latency, and infrastructure
  • Celery offers features (chains, chords, result backends) that django-vtasks intentionally omits for simplicity
  • For CPU-bound tasks, Celery's prefork pool may be more appropriate

Benchmarks last updated: February 2026