azums 0.1.3

High-performance job queue & streaming engine for Rust — from embedded to cloud
Documentation

Azums 🦀⚡

Crates.io Docs.rs 📊 Live Benchmarks Fastest Rust Job Queue CI Status License

A lightweight, high-performance job queue. The optional web dashboard is available as a separate package (azums-dashboard).

azums is an enterprise-grade, transactional background job queue and streaming framework designed for Rust web applications, CLI tools, AI agents, and microservices. Built on top of PostgreSQL, SQLite, Redis, and In-Memory storage backends with native extractors for Axum, Actix Web, Poem, and Rocket.

All backends benchmarked on every commit to main. Zero idle CPU, sub-millisecond wake-up, up to 380k jobs/sec.


⚡ Quickstart ("Hello, World!")

Add azums to your Cargo.toml:

[dependencies]
azums = "0.1"
tokio = { version = "1", features = ["full"] }
serde_json = "1"

Enqueue and process background jobs in under 2 minutes:

use azums::{quickstart, Job};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // 1. Connect to database (Postgres, SQLite, or "memory")
    let client = quickstart("memory").await?;

    // 2. Enqueue background job
    client.enqueue(Job::new("greet", serde_json::json!({"name": "World"}))).await?;

    // 3. Register job processing handler
    client.register_handler("greet", |job| async move {
        println!("Hello, {}!", job.payload["name"]);
        Ok(())
    }).await;

    // 4. Execute workers until queue is empty
    client.run_until_empty().await?;
    Ok(())
}

🆚 Why azums over other job queues?

Feature / Queue azums BullMQ (Node) Celery (Python) Sidekiq (Ruby) Factotum (Rust)
Language Rust 🦀 Node.js Python Ruby Rust
Backend Portability ✅ Single API for Postgres, SQLite, Redis, In-Memory ❌ Redis only ✅ Redis, RabbitMQ, etc. ❌ Redis only ❌ Postgres only
Instant Wake‑up LISTEN/NOTIFY, Redis PubSub, zero polling ✅ Redis PubSub ✅ Broker‑dependent ✅ Redis PubSub ❌ Polling only
Strict FIFO Ordering ✅ Per-queue configurable (default FIFO) ⚠️ FIFO per queue ❌ Best-effort ⚠️ FIFO per queue ❌ Best-effort
Framework Integrations ✅ Axum, Actix, Poem, Rocket (native extractors) ❌ None built‑in ✅ Flask, Django, FastAPI ❌ None ❌ None
Event Streams (Redis‑style) ✅ Durable stream logs with consumer groups & offsets ✅ Native Redis Streams ❌ Requires Celery Beat ❌ No native streams ❌ None
Dead‑Letter Queue (DLQ) ✅ Automatic with retry exhaustion, reason codes, and replay
Transactional Enqueue ✅ Enqueue inside DB transaction with zero dual‑write risk ❌ Separate store ❌ (to some extent)
Embedded / Edge Support ✅ SQLite & in‑memory backends for single‑binary deployment ❌ Requires Redis process
Idle CPU Usage 0.0% Low Medium Low High (polling)
Max Throughput (enqueue) 380,000 jobs/sec (in‑memory) ~5,000–10,000/sec ~2,000–5,000/sec ~5,000–10,000/sec ~8,500/sec
Licensing MIT / Apache 2.0 MIT BSD LGPL / Pro MIT
Open Source Dashboard 🚧 Coming as separate crate ✅ Built‑in ✅ Flower ✅ Sidekiq UI ❌ None
Managed Cloud Offering 🚧 Beta planned ✅ (via Redis Enterprise) ✅ (Celery Cloud) ✅ (Sidekiq Pro)

🔑 Key Differentiators

  • One library, any database. Your code looks identical whether you use Postgres, SQLite, or Redis. No lock‑in.
  • Zero‑cost idle. Unlike polling‑based Rust queues, azums workers consume no CPU when the queue is empty—saving battery and server costs.
  • Natively embedded. Run a full job queue inside your CLI tool, desktop app, or IoT device with SQLite. No external services required.
  • Streams without a broker. Durable, replayable event streams are built into the database backend—just like Redis Streams, but your existing database handles it.
  • First‑class Rust web framework support. Drop azums-axum into your project and inject a JobQueue directly into route handlers—something no other Rust queue offers.

🔗 See the Live Benchmarks Dashboard for reproducible, up‑to‑date performance numbers.


🏗️ Storage Backend Compatibility

Swap storage backends effortlessly with zero application code changes:

Backend Connection URL Feature Flag Ideal Use Case
PostgreSQL postgres://user:pass@localhost/db postgres (default) Multi-node Kubernetes microservices & production DBs
SQLite sqlite://jobs.db?mode=rwc sqlite (default) Single-binary web apps, desktop tools, IoT edge devices
Redis redis://127.0.0.1:6379 redis (default) Ultra-low latency memory queue & native streams
In-Memory memory Core Fast unit tests, CI test pipelines, zero disk I/O

🌐 Native Web Framework Extractors

azums provides native request extractors for every popular Rust web framework:

// Axum route handler with JobQueue extractor
async fn create_user(queue: JobQueue, Json(payload): Json<UserPayload>) -> impl IntoResponse {
    let job_id = queue.enqueue_now("default", "welcome_email", json!(payload)).await?;
    Json(json!({ "status": "queued", "id": job_id }))
}

⚡ Performance & Micro-Benchmarks

azums is built for maximum throughput with minimal overhead. Run Criterion benchmarks locally:

# Run Criterion micro-benchmarks
cargo bench -p azums
Benchmark Target Operation Throughput / Speed
enqueue_single_job Atomic In-Memory Enqueue > 100,000 ops/sec
worker_process_batch_100 Lease, Attempt, Complete Batch < 1.5 ms / 100 jobs

📚 Documentation & Book


💬 Community & Support

  • GitHub Discussions: Have questions, feature requests, or architecture ideas? Join our GitHub Discussions.
  • Issue Tracker: Found a bug or issue? Report it on our GitHub Issues tracker.

🤝 Contributing & License

Contributions are welcome! Please read CONTRIBUTING.md and CODE_OF_CONDUCT.md.

Licensed under either of Apache License, Version 2.0 or MIT License at your option.