Skip to main content

A fast distributed task queue with a Rust core and a Python API, backed by Redis streams.

Project description

ArdiQ

PyPI version Python versions CI License: MIT


A fast distributed task queue with a Rust core and a clean Python API, backed by Redis streams.

ArdiQ runs the worker loop and all Redis I/O in Rust (via PyO3 + tokio); you write tasks in plain Python. The two meet at a single async callback, with the GIL held only for the microseconds it takes to start a task and read its result — so a single process handles high concurrency.

Features

  • 🦀 Rust core — the loop and Redis I/O run on tokio, off the GIL
  • Priority queues — higher-priority tasks are consumed first
  • Delayed & scheduled tasks (delay_ms / schedule_ms)
  • Cron & recurring tasks (@app.cron) — 5-field cron (UTC) or every= intervals
  • Automatic retries with quadratic backoff, configurable per task
  • Crash recovery — in-flight tasks of a dead worker are reclaimed (XAUTOCLAIM)
  • Results with TTL, plus task status (queued / running / complete / not_found)
  • Sync & async tasks — blocking sync functions run in a thread pool
  • CLI worker (ardiq run module:app) and burst mode (drain the queue and exit)

Performance

Because the worker loop and every Redis round-trip run in Rust — off the GIL — ArdiQ delivers top-tier throughput at a fraction of the memory of comparable Python task queues.

Benchmarked head-to-head against arq, Taskiq, Streaq, Celery and Dramatiq on the same machine (1,000 tasks, one worker, 10 concurrent):

Queue Throughput Memory
ArdiQ 🦀 top tier ~34 MB 🪶
Taskiq top tier ~95 MB
Streaq fast ~50 MB
arq fast ~30 MB
  • 🏆 Among the fastest async queues on both CPU- and I/O-bound workloads — effectively tied with the leader.
  • 🪶 Lightest in its class — roughly a third of the memory of the next-fastest queue, and the lowest footprint of any queue at its performance level.
  • 📈 Near the theoretical ceiling on I/O work — practically network-bound, with nothing lost to scheduling.
  • 🎯 Rock-steady — negligible variance run to run.

Throughput is shaped by hardware and workload, and the GIL caps in-process CPU work for every Python queue (ArdiQ included). The full, reproducible suite — with the honest caveats — lives in the benchmark repo.

When to use ArdiQ

Reach for ArdiQ when you want:

  • High concurrency on a small footprint — async-native, with the loop and Redis I/O in Rust, so one process does a lot without eating memory.
  • A modern, typed API@app.task, awaitable enqueue, Job handles, results and status built in.
  • Reliability out of the box — priorities, retries with backoff, delayed and scheduled tasks, and crash recovery via Redis consumer groups.
  • Redis you already run — no extra broker to operate.

Consider the alternatives when:

  • You need to saturate many CPU cores in one process — like every single-process Python queue, ArdiQ runs your task body under the GIL, so CPU-bound work is serial per worker (scale out with more workers). For heavy CPU fan-out, a prefork model (Celery, Dramatiq) can be simpler.
  • You need a large, battle-tested ecosystem today — Celery has years of integrations, schedulers, and dashboards. ArdiQ is young and moving fast.
  • You can't run Redis — ArdiQ is Redis-only by design.

ArdiQ sits alongside arq / Taskiq / Streaq as a modern async queue — its edge is the Rust core (memory and per-task overhead) and a batteries-included API.

Installation

$ pip install ardiq

The base install is the library only — a single runtime dependency (msgpack) — enough to define tasks, enqueue them, and run a worker from your own code (await app.run()). For the ardiq worker command, add the CLI extra:

$ pip install 'ardiq[cli]'

You also need a Redis server — the quickest way is Docker:

$ docker run -d --name ardiq-redis -p 6379:6379 redis

or install it from your package manager (or redis.io).

Building from source (if you want to hack on ArdiQ itself): you'll need Rust and uv. Clone the repo and run uv sync.

Quickstart

Define an app and some tasks (example.py):

from ardiq import Ardiq

app = Ardiq(redis_url="redis://localhost:6379", queue_name="example")


@app.task()
async def add(a: int, b: int) -> int:
    return a + b


@app.task(max_retries=3)
def slow_double(x: int) -> int:   # sync task — runs in a thread
    return x * 2

Start a worker:

$ ardiq run example:app

Enqueue tasks from anywhere and read their results:

import asyncio
from example import add


async def main():
    job = await add.enqueue(2, 3)        # returns a Job handle
    print(job.id)
    print(await job.status())            # 'queued' | 'running' | 'complete'
    print(await job.result(timeout=5))   # waits → TaskResult(success=True, value=5, tries=1)


asyncio.run(main())

Or run the whole thing in one process with python example.py, which enqueues a few tasks and processes them in burst mode.

Recurring tasks

Register a task to run on a schedule with @app.cron — either a standard 5-field cron expression (evaluated in UTC) or a fixed every= interval:

@app.cron("0 3 * * *")            # daily at 03:00 UTC
async def nightly_report():
    ...


@app.cron(every=30)               # every 30s — int/float seconds or a timedelta
async def heartbeat():
    ...

Recurring tasks fire while a worker is running, and each occurrence is an ordinary task with its own result, status, retries and timeout. The cron syntax is the common subset — *, lists ,, ranges a-b, and steps */n — at minute resolution; use every= for sub-minute schedules.

Configuration

Ardiq(...) accepts:

Option Default Description
redis_url redis://localhost:6379 Redis connection URL
queue_name "default" Logical queue (key namespace)
priorities ["default"] Priority names, lowest-first
concurrency 16 Max tasks running at once
prefetch concurrency * 2 Max tasks held in memory (drives backpressure)
idle_timeout_ms 60000 When an unrenewed in-flight task may be reclaimed
result_ttl_ms 300000 How long results live (0 drops, negative keeps forever)
burst False Exit once the queue drains
serializer / deserializer msgpack Wire codec; pass pickle.dumps/pickle.loads to send datetimes/objects
cron_poll_s 1.0 How often the worker restages due @app.cron occurrences

@app.task(...) accepts name, max_retries (default 3), backoff_ms, timeout (seconds), and priority. @app.cron(spec, *, every=…, …) takes those same per-task options plus the schedule. Use task.options(delay_ms=…, schedule_ms=…, priority=…, task_id=…).enqueue(...) for one-off overrides.

Development

$ docker compose up -d      # Redis on localhost:6379
$ uv run pytest             # test suite (needs Redis)
$ uv run ruff check .       # lint
$ uv run ty check ardiq tests   # type-check

After changing the Rust core, rebuild with uv sync --reinstall-package ardiq.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ardiq-0.2.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ardiq-0.2.0-cp39-abi3-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

ardiq-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

ardiq-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

ardiq-0.2.0-cp39-abi3-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

ardiq-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file ardiq-0.2.0.tar.gz.

File metadata

  • Download URL: ardiq-0.2.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ardiq-0.2.0.tar.gz
Algorithm Hash digest
SHA256 75a0ed9c301a9572fda4bbebf8c92e190c633f9eed2ccb46ff9b7b5d83e669c4
MD5 2ab37f87a419842ae4847ec5c1ea4f0d
BLAKE2b-256 f8e40e2e9f6a993eb2542cc68a9f150ae87cd761cc536f04561d75489e65003a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.2.0.tar.gz:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ardiq-0.2.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: ardiq-0.2.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ardiq-0.2.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 65c4645efdf5ae7065e161162891f8498972f6000d47c05cdfb930748ba10e1d
MD5 11887e7ae3909349ee7adcc46b8af25e
BLAKE2b-256 9e44f38d7e1d94adb96da747b9a2db81991f3fdd9bfe36bdb5df790b8b5a9d3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.2.0-cp39-abi3-win_amd64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ardiq-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ardiq-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3f590fc17096c5e78b1a5e9e9ef40d3c96b61007997d0169a19a3f78397ac57
MD5 5b9681ddd1311d6b749f912e4747d162
BLAKE2b-256 20ca5f5de63c5ba06a02be96f6a97eb764696a8d8d56c1c61f5ada9d07862dcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ardiq-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ardiq-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d4573ee5bbbca69db4b3b8544d58ea854876191c7c9095c30b8ad147e0351c2c
MD5 cdc10b03b1afd5ef546dbe420b0ec7a6
BLAKE2b-256 66206c8ab9cb5bb572d3ba3743201b6e1b44adcf35d23731098059eec7ed773e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ardiq-0.2.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: ardiq-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ardiq-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19d2bafe0af6b25f957d573dc98841fe3d501e91ae94978e268b245bd4cafb69
MD5 195a519691d2524ed807f04c4c394fd2
BLAKE2b-256 3f3d93382a13cb5efe47c754bdc42344a7f00cba68a27431d07386ef18e611ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.2.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ardiq-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ardiq-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0d6c1b1d4c06d54f85a8a447ebffacc9fd1d635b33e231e8bf91677bab6d2a73
MD5 b2aec0a93cdd17e39c5586fb8d6b42f3
BLAKE2b-256 2be9bcad841034c24b9fdfeea35a6fa414f6494d37ac0bc506ebc354cc8e3095

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page