Skip to content

v0.3.0 - Scale queues and harden durable workflows

Choose a tag to compare

@Kludex Kludex released this 11 Sep 10:25
· 22 commits to main since this release
aeabbf9

🐘 Scale queues and harden durable workflows

pgtask is a task queue, scheduler, and durable workflow runtime that keeps every piece of state in PostgreSQL. No broker, no coordinator, no extension.

This release improves the hot paths for busy queues, closes two durable-workflow correctness gaps, adds ordered batch enqueueing to every SDK, and expands support to PostgreSQL 16.

pip install pgtask==0.3.0

🚀 Move more work with fewer database operations

  • Enqueue batches through Python, TypeScript, and Go (#17). The new APIs preserve request order and commit each batch atomically. The repository benchmark increased from 2,131 to 7,353 enqueued tasks per second.
  • Keep lease recovery out of the claim path (#15). Workers recover expired leases on a dedicated interval instead of scanning before every claim.
  • Remove redundant writes and notifications (#19). Completion throughput increased from 1,349 to 2,660 tasks per second in the repository benchmark, while deterministic sharded wakeups remain unchanged.
  • Scale worker demand sampling by queue, not replica count (#18). One worker samples queue-wide demand per heartbeat interval, avoiding the same scan from every replica.
  • Fill Python worker capacity in one claim (#20). Claim batches now follow configured concurrency instead of fetching one task at a time.

🧱 Preserve durable workflow progress

  • Close the result-wait lost-wakeup race (#29). Result-wait registration now serializes against child completion, so a child cannot finish while its parent's uncommitted wait is invisible. Lease renewal also locks workflow ancestry in a consistent order to avoid deadlocks.
  • Keep durable resumptions outside the retry budget (#35). Sleeps, signal waits, and child-result waits can resume after the final execution attempt because only failures consume retry budget. Worker backoff now follows failed attempts rather than the number of resumptions.
  • Reject unsupported interval precision cleanly (#34). Fractional-millisecond schedules now return ScheduleError::UnsupportedIntervalPrecision instead of panicking or changing during a PostgreSQL round trip.

🔭 Operate larger and broader installations

  • Run on PostgreSQL 16, 17, or 18 (#22). Every Rust and SDK test matrix now covers PostgreSQL 16, and the documented minimum has been lowered accordingly.
  • Browse every schedule and worker (#46). Observer pages use indexed keyset pagination instead of rendering everything or silently stopping at 100 records. Dashboard totals remain exact.
  • Choose pgtask with direct comparisons (#36). The documentation now compares pgtask with Absurd, Celery, Dramatiq, and ARQ, with migration guidance alongside each comparison.

🧪 Test the guarantees, not only the examples

The PostgreSQL kernel now has state-machine and mutation tests for lease fencing, attempt budgets, priority, and cancellation (#26); property tests for schedule and retry arithmetic (#31); TLA+ models for task lifecycle and wait registration (#27); and fault-injected linearizability checks for leases, checkpoints, idempotency, capacity, and waits (#32).

Nightly stress runs increase the property and model case counts, model-check the TLA+ specifications, and preserve failure evidence. Weekly SQL mutation runs verify that the tests reject deliberately broken guarantees (#43). Workflow security analysis (#37), deterministic timing fixes (#38, #44), and handler-version routing coverage (#45) keep those signals trustworthy.


⬆️ Upgrading

This release adds migrations 0003 through 0008 and introduces storage protocol 2. Run migrations before replacing workers:

PGTASK_DATABASE_URL="$DATABASE_URL" pgtask migrate

Migration 0004 expands the database range to 1..=2. Existing protocol 1 workers and producers remain compatible during a rolling upgrade, while 0.3.0 workers require protocol 2. The Helm chart runs the migration hook before replacing worker Deployments.

pgtask.queue.ready.tasks is now queue-wide demand supported by any live, non-draining worker. Do not use it to scale separate Deployments with disjoint handlers on one shared queue. Use separate queues or a capability-aware external metric in that topology.


📦 What ships

Artifact Contents
Rust crates pgtask, pgtask-core, pgtask-postgres, pgtask-worker, pgtask-otel, pgtask-cli, pgtask-web
Python wheel Stable ABI for CPython 3.10+ on Linux, macOS, and Windows, plus a source distribution
npm @pgtask/client for Node.js 20 or newer
Go module github.com/Kludex/pgtask/sdks/go for Go 1.25 or newer
Container image ghcr.io/kludex/pgtask:0.3.0, multi-architecture, Sigstore signed
Helm chart Signed OCI chart with per-queue worker Deployments, migration Job, probes, and optional autoscaling

⚠️ Not ready for production

This is a preview. The engine passes its suite against real PostgreSQL and has never run a production workload. The Rust, Python, SQL, CLI, and telemetry surfaces may change before 1.0; the storage protocol range is the compatibility contract in the meantime.

Delivery is at least once. A handler can finish an external side effect and lose its lease before recording the result, so handlers must be safe to run again.


Documentation: https://kludex.github.io/pgtask/

Full changelog: v0.2.0...v0.3.0