Repository navigation
Release 0.2.2: parallel task calls, named task limits, late lease renewal warning - #43
Merged
Merged
Conversation
- Each async task call runs as a tokio task of its own, so the calls a workflow makes at once (try_join!, join_all, for_each(..).concurrency(n)) run in parallel instead of sharing the workflow's thread. Dropping the call's future still stops it. - Named limits: #[task(limit = "name")] on async, blocking and #[tasks] method tasks; EngineBuilder::limit(name, permits) defines one for the whole engine, and EngineBuilder::blocking_limit(n) covers blocking tasks that name none. Calls wait for a permit in order without holding a thread; a blocking call keeps its permit until its thread is done. YAML `call:`s of Rust tasks wait too. build() rejects an undefined limit or one with no permits. The heartbeat timeout starts once a call has its permit. With `metrics`, jackdaw_task_limit_waiting counts the waiters. - The lease loop warns when it wakes more than a quarter of the lease TTL late (the runtime's threads were busy), pointing at blocking code in async tasks. Specs: tasks/task_limits.feature (11 scenarios) and operations/lease_renewal.feature (2), written before the implementation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Batch jobs written as one workflow with many CPU-heavy calls used one core: concurrent calls of an instance shared the instance's tokio task. This PR makes those calls run in parallel, adds a way to cap them, and reports the one hazard that parallel async work makes easier to hit.
NativeTask::invoke).futures::try_join!,join_allandctx.for_each(..).concurrency(n)now run in parallel on the runtime's threads. This also covers a YAMLforkwhose branches call Rust tasks. Dropping the call's future still aborts it. Replay is unaffected, since results are journaled by sequence number.#[task(limit = "name")]works on async tasks, blocking tasks and#[tasks]methods, and several tasks can share a limit.EngineBuilder::limit(name, permits)defines it for every instance the engine runs.EngineBuilder::blocking_limit(n)covers blocking tasks that name no limit; without it they are not limited, as before.call:of a Rust task waits for the task's limit too.build()rejects a limit the engine doesn't define, and one with 0 permits.metrics, thejackdaw_task_limit_waitinggauge counts the waiting calls per limit.lease renewal ran late, with the delay, and suggests#[task(blocking)]. Only the loop's sleep is timed, so a slow store does not trigger it.No rayon:
spawn_blockingplus semaphores covers the cap, and tasks can still use rayon inside.Release
Bumps the workspace to 0.2.2 (
Cargo.tomland its=0.2.2pins,Cargo.lock, the Dockerfile label, andCHANGELOG.mddated 2026-11-02). Merging triggers release-on-merge: binaries, the Docker image, thev0.2.2GitHub release and the crates.just publish- 8000 dry-runpasses. If this merges after 2026-11-02, update the changelog date first.Tests
The specs were written before the implementation and failed first:
tasks/task_limits.feature, 11 scenarios:try_join!and withfor_each(..).concurrency(2).#[tasks]method.forkrespects the limit.operations/lease_renewal.feature, 2 scenarios, each on a one-thread runtime of its own:Results:
🤖 Generated with Claude Code