runtime: add an opt-in sharded spawn_blocking queue (#8337)

Re-lands the sharded queue from #7757 (reverted due to #8056), disabled by
default. Opt in via the unstable `Builder::enable_sharded_blocking_queue` or
the `TOKIO_UNSTABLE_SHARDED_BLOCKING_QUEUE` environment variable.
This commit is contained in:
Alex Gaynor
2026-08-09 16:35:12 +00:00
committed by GitHub
parent d4569bb550
commit 8b13642a1f
10 changed files with 586 additions and 61 deletions
+24
View File
@@ -315,6 +315,30 @@ jobs:
# the unstable cfg to RustDoc
RUSTDOCFLAGS: --cfg tokio_unstable
# Run the test suite with the sharded `spawn_blocking` queue.
test-sharded-blocking-queue:
name: test tokio full with sharded blocking queue
needs: basics
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_stable }}
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2
- name: test tokio full with sharded blocking queue
run: cargo nextest run --features full
working-directory: tokio
env:
TOKIO_UNSTABLE_SHARDED_BLOCKING_QUEUE: "1"
test-unstable-taskdump:
name: test tokio full --unstable --taskdump
needs: basics
+9
View File
@@ -28,6 +28,13 @@ jobs:
# base_ref is null when it's not a pull request
if: github.repository_owner == 'tokio-rs' && (contains(github.event.pull_request.labels.*.name, 'R-loom-blocking') || (github.base_ref == null))
runs-on: ubuntu-latest
strategy:
matrix:
# Run the blocking pool loom tests against both `spawn_blocking`
# queue implementations.
include:
- sharded_blocking_queue: "0"
- sharded_blocking_queue: "1"
steps:
- uses: actions/checkout@v7
- name: Install Rust ${{ env.rust_stable }}
@@ -38,6 +45,8 @@ jobs:
- name: run tests
run: cargo test --lib --release --features full -- --nocapture loom_blocking
working-directory: tokio
env:
TOKIO_UNSTABLE_SHARDED_BLOCKING_QUEUE: ${{ matrix.sharded_blocking_queue }}
loom-sync:
name: loom tokio::sync