Repository navigation
Description
TUnit can change how many tests run in parallel while a run is in progress, based on machine load and on whether a higher limit completes more tests per second. The feature is experimental and off by default. This issue collects reports from real test suites so we can decide what to change before it becomes stable.
Please comment whether it helped, made no difference, or made things worse. Reports of "no change" are useful too.
How to try it
Adaptive parallelism shipped in v1.88.0. Adaptive [ParallelLimiter<T>] limits and the shared budget across test processes shipped in v1.90.0.
dotnet run --project MyTests -- --adaptive-parallelism
# or
TUNIT_ADAPTIVE_PARALLELISM=1 dotnet testYou can also set context.Settings.Parallelism.Adaptive = true in a [Before(HookType.TestDiscovery)] hook. That use reports diagnostic TUNITEXP001, which you suppress to opt in.
For a group of tests that shares limited capacity, such as a database, implement IAdaptiveParallelLimit in place of IParallelLimit and use it with [ParallelLimiter<T>].
See Adaptive Parallelism and Adaptive Limiter for how the limit moves, the bounds you can set, and what TUnit measures.
What to include
- The summary line. At the end of the run TUnit prints a line that starts with
Adaptive parallelism:, and one line for each adaptive limiter. Paste them as they are. - Wall-clock time for the same suite with and without
--adaptive-parallelism, ideally over a few runs. - Environment: TUnit version, .NET version, OS, CPU count and memory, and whether the run is local, in CI or in a container (with its CPU and memory limits).
- The suite: roughly how many tests, and what they mostly do (CPU-bound work, I/O, databases, containers, browsers or other child processes). Say whether other test processes run on the same machine at the same time.
- Any flags you set:
--maximum-parallel-tests,--adaptive-min-parallel-tests,--adaptive-max-parallel-tests, and any[ParallelLimiter<T>]you use. - Debug log, if the limit moved in a way you did not expect, or never moved. Run with
--log-level Debug, or setTUNIT_LOG_LEVEL=Debug. The log gives each change, its reason, and the CPU use of the machine and of the test process. Attach it as a file or a gist, not inline.
If a test fails only with adaptive parallelism on, rerun with --maximum-parallel-tests set to the highest limit in the summary. Tell us whether the failure reproduces with that fixed limit.
Open a separate issue for a clear bug, such as a crash or a hang, and link it here.
Activity
thomhurst commentedon Nov 30, 2026
Report from a CI run with adaptive parallelism on. Summary: one large test process got about 10% faster and made the whole workflow faster. Most other processes never moved off their starting limit. No new test failures.
Environment
dotnet runubuntu-latest(Ubuntu 26.04 image), 4 vCPU / 16 GB, about 20 parallel jobsTUNIT_ADAPTIVE_PARALLELISM: 1at workflow level. No adaptive bounds set. No--maximum-parallel-testsin these jobs, so every process started at 8.[ParallelLimiter<T>](non-adaptive) and[NotInParallel]attributes are unchanged.TUNIT_SHARED_PARALLEL_BUDGETis not set.Wall clock
One adaptive run compared with three recent
mainruns. Caveat: themainruns used TUnit 1.87.12, so this compares the TUnit update and adaptive mode together, not adaptive alone.Good
[ParallelLimiter<T>], passed with no new failures or flakes.Bad, or confusing
"The CPUs have no headroom" while the machine is mostly idle. Two processes that ran for about 3 minutes each reported:
At 13% average CPU, "no headroom" reads as a contradiction. The decision may be correct if it was made during short busy periods, but the summary does not say so. Could the summary state the CPU figure the decision actually used, such as busy time while it was deciding?
Ramping up takes time. The large process spent about 90 s at 6 to 12 before it reached 18. That is fine for a 13-minute run. Short processes never got past their starting limit, so adaptive mode cannot help them.
A CPU-bound suite got no faster. Analyzer Tests (this process alone at 83% CPU) lowered its limit to 4 for 19 s and to 6 for 17 s, then returned to 8. The run took 1m56s, the slow end of its baseline. Lowering the limit seems reasonable, but nothing was gained.
Busy shared runners keep it at the starting limit. In the job that runs several test processes and Redis containers together, every process reported the machine 93–96% busy with itself using 8–10%, and stayed at 8. That matches the docs (other processes and containers do not lower the limit). It does mean adaptive mode does nothing in that job unless we set
TUNIT_SHARED_PARALLEL_BUDGET, which we have not tried yet.The summary line is long. Lines run past 600 characters, so CI log viewers cut them off or wrap them. Some sentences are hard to follow, for example "Its child processes used 0% in the 1s they were measured, which is while the CPUs were nearly saturated". A short first line (range, final limit, top reason), with the detail on further lines or only at
--log-level Debug, would scan better in CI logs.No debug logs were captured for this run. I can collect
--log-level Debugoutput for the "no headroom at 13% CPU" processes if that would help.thomhurst commentedon Nov 30, 2026
No change: CPU-bound CI runner, limit never moved
Adaptive parallelism made no difference to wall-clock time on our CI. The limit stayed at its start value of 8 in all 36 test processes, because the runner's CPUs were saturated for the whole run. Most of that CPU went to database and broker containers, not to the test processes. Holding the limit looks like the right decision here.
Environment
ubuntu-latest: 4 vCPU, 16 GB memory. Not in a container.dotnet testover a solution with 18 test projects. MTP runs 4 test processes at once (--max-parallel-test-modulesdefault = processor count).TUNIT_ADAPTIVE_PARALLELISM=1, plusTUNIT_LOG_LEVEL=Debugfor the diagnostic run. No--maximum-parallel-tests, no adaptive bounds, no[ParallelLimiter<T>].Suite
About 3,600 tests per framework. Most are I/O against real servers in Docker: PostgreSQL, SQL Server, MySQL, Kafka, NATS, RabbitMQ and the Pub/Sub emulator, each shared once per test process. One project (about 1,500 tests) is in-memory, and one runs Roslyn source generator tests.
Wall-clock time (
dotnet teststep, per framework job)All adaptive results are inside the normal spread of hosted runners. The sum of per-project durations varies from about 670 s to 1,200 s between runs with or without adaptive, so the host matters far more than the limit.
Summary lines
Every process printed a variant of this (36 of 36 say "stayed at 8"):
The debug log repeats
not raising the limit of 8: the CPUs have no headroomandnot lowering the limit of 8 for CPU saturation: ... this process and its child processes use only 4%–30% of them. Three processes also loggedmemory has no headroomonce.Debug logs (one
.diagfile per test process), plusvmstatanddocker statssamples taken every 10 s: net10.0, net11.0 from this run.What used the CPU
vmstat: 67% user, 21% system, 4% idle on average, with about 34 runnable threads on 4 CPUs.docker stats: containers used about 240% of the 400% available on average (peaks about 350%). The shared PostgreSQL container alone averaged about 45%.So the decision to hold looks correct. Raising the limit would add load to containers that are already saturated, and lowering it in one process would not free much CPU.
Observations for the feature
dotnet testwith several test projects. The MTP terminal output prints only one result line per project, so theAdaptive parallelism:line never appears in the CI log. We found it only with--diagnostic --diagnostic-verbosity Debug, or by running one project withdotnet run. Without it, a user cannot tell whether the feature did anything. Could the summary reach thedotnet testoutput (for example as a per-project message) or the HTML report?TUNIT_SHARED_PARALLEL_BUDGETyet. On a container-bound runner we would not expect it to change much.For us, the bottleneck is CPU on a 4 vCPU runner and the order in which
dotnet teststarts the projects, not TUnit's parallel limit. We will look at those in Relayer (tracking PR: thomhurst/Relayer#1727).thomhurst commentedon Nov 30, 2026
Result: slower on 4-vCPU CI runners, no change on a 20-core desktop
On GitHub-hosted 4-vCPU runners,
--adaptive-parallelismmade our suites slower. The limit almost never moved, so the time went into overhead with no gain. Setting--adaptive-max-parallel-testsequal to the starting limit (8) removed most of the slowdown on Linux. That points at the extra workers adaptive mode starts, not at the sampler. On a 20-core desktop, including runs pinned to 4 cores, adaptive and fixed timed the same.Wall-clock time in CI
The times are the
durationTUnit reports, summed over every test project in a job and averaged over the runs. Projects run one after another, one test process at a time. Runs of each mode were started alternately withworkflow_dispatch, so they shared similar runner conditions.TUNIT_ADAPTIVE_MAX_PARALLEL_TESTS=8(3 runs)Single projects, ubuntu, mean seconds:
Notes:
Summary lines
In 124 of 132 adaptive project runs the limit stayed at the starting value:
The other runs were a short cut to 6 that was never restored, or a raise to 12 that was put back:
Local runs: no difference
Windows 11, 20 logical CPUs, 6 alternating runs per mode. The test executables were run directly, with and without coverage.
So 32 workers for 8 slots cost nothing measurable on a fast, otherwise idle machine. The cost appears only on the smaller, busier CI runners.
Likely cause
I read the v1.90.0 source. With adaptive on and no
--adaptive-max-parallel-tests, the limits on a 4-CPU machine are start 8, minimum 2, maximum 32 (TestScheduler.GetAdaptiveLimits). Three things follow:ParallelLimiterLanes.RunAsyncsizesParallel.ForEachAsynctolimiter.MaxParallelism, so 32 workers compete for 8 slots. Fixed mode runs 8 workers for 8 slots.SemaphoreSlim(1, 1)turn, and every test goes throughWaitInTurnAsync: take the turn, then wait for a slot. With 32 workers and 8 slots, the worker holding the turn almost always waits asynchronously for a slot, and the others wait for the turn. Each test start then needs two continuations through the thread pool: the slot release wakes the turn holder, and its turn release wakes the next worker. It also allocates an asyncTaskstate machine and two semaphore waiters. In fixed mode the slot wait is usually uncontended and completes synchronously.The max-8 runs support this: they keep the sampler and the resizable limiter but drop the extra workers, and the Linux slowdown went away. One caveat: max 8 also stops any raise trials, but the summaries show almost none happened, so the extra workers are the likelier cost.
Two smaller points I noticed and did not measure separately:
Disposejoins it for up to 1s. Our projects that finish in under a second were 0.15s to 0.4s slower under coverage, which fits a fixed startup or shutdown cost._lowerHoldUntilstarts at zero and the 15s hold applies only after a lowering trial. Some short runs therefore ended at 6 with no chance to restore the limit.Suggestions
In order of expected impact:
WaitInTurnAsyncreturnValueTask.Disposeon a controller that is still setting up.Environment
ubuntu-26.04(image 20261122.9.1) andwindows-2025-vs2026(image 20261123.321.1), 4 vCPU each.--coverage(Microsoft.Testing.Extensions.CodeCoverage, as bundled with TUnit), instrumenting only the library under test, not TUnit's assemblies.--maximum-parallel-tests, no--adaptive-min-parallel-tests, and no[ParallelLimiter<T>]in these projects.This was measured for Kevlar in thomhurst/Kevlar#754. We are staying on the fixed limit for now.
thomhurst commentedon Nov 30, 2026
Report from a second CI suite (a Kafka client). Summary: no change in wall-clock time. Test time was +1.3% against the baseline median, with every job inside its baseline range. No new failures that came from adaptive mode. The per-test timings show why: in these suites the session-wide limit is almost never what bounds the run, and in one case the summary hides that.
Environment
ubuntu-latest, 4 vCPU / 16 GB, one test job per runner. Integration jobs share the runner with a Kafka broker in a Testcontainers container.context.Settings.Parallelism.Adaptive = truein a[Before(HookType.TestDiscovery)]hook. No bounds and no--maximum-parallel-tests, so every process started at 8 (2..32).[ParallelLimiter<T>]. Many[NotInParallel], both unkeyed and keyed.--log-level Debugis on in CI, so the logs have every decision: run 1, run 2.The suites
Wall clock
Time of the "run tests" step. The baseline is the median of 10 recent green runs.
Summary lines:
In run 2, 9 of 60 test processes moved off 8. Most of the raises were put back.
Why nothing changed
I rebuilt the number of running tests over time from the
startTime/endTimeof every test in the JSON report:[NotInParallel]phase, then CPUSemaphoreSlim(4)taken in[Before(Test)][NotInParallel]chainSo adaptive mode behaved correctly. The raises it tried were put back because they did not help. These suites are bound by serial tests, by CPU, or by a cap in user code.
What would have helped us see this faster
[Before(Test)]hook is invisible to the controller. Our integration base class takes aSemaphoreSlim(4)per broker in[Before(Test)], because the broker cannot take more coordinator-heavy tests at once. Tests waiting on it appear to hold TUnit parallel slots, so the slots look full and TUnit tries raises that cannot help. In that process the summary's most common reason was "throughput is still changing between measurements", not "fewer tests are ready". The real cause stays hidden.[Before(Test)]hooks while they hold a slot? Or could the docs recommend moving such caps to an adaptive[ParallelLimiter<T>], since tests waiting on a limiter do not block other tests? We plan to try the second.[NotInParallel])" would have told us at once that no parallel limit could shorten 40% of the run. The same goes for the integration process that ran one test at a time for 94% of its 11 minutes.Changing nothing would have been the right result here. Items 1 and 2 would have pointed us straight at the real bottlenecks, which are the serial chains and our own semaphore, instead of the parallel limit.
thomhurst commentedon Nov 30, 2026
No change from session-wide adaptive mode. An adaptive limiter could not adapt a small group of slow tests.
Summary. Turning on
--adaptive-parallelismmade no difference on our CI, because 98% of each run has only one test running. The cause is one[NotInParallel]class whose tests each start a PowerShell child process. Replacing that[NotInParallel]with a[ParallelLimiter<T>]at limit 2 halved test time. When that limiter was adaptive, it almost never moved: the group finished before the limiter had enough completions to start a trial. A limiter that starts at its maximum also cannot be lowered, even when its own child processes saturate the CPUs.Environment
dotnet teston Microsoft.Testing.Platform.ubuntu-latest,ubuntu-24.04-armandwindows-latest, 4 vCPU each, one job per runner. No containers.TUNIT_ADAPTIVE_PARALLELISM: 1at workflow level. No bounds and no--maximum-parallel-tests. Every process loggedlimit starts at 8 and moves between 2 and 32.The suite
About 270 tests per process. 248 of them are fast, in-memory concurrency tests, and they all finish within 1.3–3.2s. The other 22 are in one class marked
[NotInParallel]. Each of those tests startspwshto run a script, and one test starts it 24 times in a row. These tests take 0.4s to 25s each, about 57s in total on ubuntu-latest.Wall clock: session-wide adaptive mode
dotnet teststep for the first two test processes, plus the third, in seconds:All within runner noise. Typical summary line (all 9 processes stayed at 8):
Rebuilt from the JSON report's
startTime/endTime, ubuntu-latest, net10.0: wall time 57.3s, of which 56.0s had exactly one test running. The other tests were done after 1.3s. This is the same pattern as the Dekaf report above. A "for 56s only one test was running" line would have shown the cause immediately. Instead, the top reason given was "the CPUs have no headroom" at 31% average CPU.What helped: replacing
[NotInParallel]with[ParallelLimiter<T>]The class now uses
[ParallelLimiter<PowerShellLimit>], wherePowerShellLimit : IAdaptiveParallelLimitand its start and maximum limits come from environment variables. Session-wide adaptive mode stayed on. One CI run per variant, all green:[NotInParallel])For one test process, ubuntu-latest, net10.0:
On a 4-vCPU Linux runner, 4
pwshprocesses at once saturate the CPUs. Each test then takes twice as long, and the run is slower than at limit 2. So the best limit is somewhere around 2–3 here. On a 20-core desktop the best limit is higher: locally, 8 and 20 both took about 11s, against 14s at limit 2 and 27s serial. That variation is exactly what an adaptive limiter is for, and it could not find either limit.Why the adaptive limiter did not adapt
the limit stayed at 2in every run. On CI it raised 2 → 3 in 2 of 9 processes and in none of the others. FromAdaptiveLimiterPolicyin v1.90.0, a window closes only aftermax(8, 2 × limit)completions (or 30s). Then the limit must stay steady, within 15%, over two measurable windows before the first raise. At limit 2 that means 16 completions with steady throughput. This group has 22 tests whose durations range from 0.4s to 25s, so it ends first, or its throughput is never steady. A minimum count of completions works for hundreds of short tests. It rules out a group of a few slow ones, which is where the right limit is hardest to guess.the limit ranged from 2 to 3 over 1 change and ended at 3. As far as I can tell the raise was never judged, because the group ran out of tests first. The summary could say that the trial had no verdict.the limit stayed at 2, and at--log-level Debugnothing at all is logged for the limiter when it does not change. A reason such as "not enough tests finished to measure throughput (5 of 16 needed)" would have explained it.pwsh, but none of the 9 serial-run summaries has an "Its child processes used" sentence. The debug log saysthis process and its child processes use only 41%–49%while the CPUs were saturated. Each child lives about 0.4–1s. Are processes that start and exit between two 250 ms samples counted?Suggestions, in order of expected value for suites like this
max(8, 2 × limit)completions twice.[NotInParallel]key caused it.Logs
Debug
.diagfiles and JSON reports for every process are attached as artifacts to these runs:Session-wide adaptive runs: adaptive, fixed.
Measured for Reservoir in thomhurst/Reservoir#224 and thomhurst/Reservoir#225.
thomhurst commentedon Nov 30, 2026
Shared parallel budget: slower for I/O-bound suites, because equal parts give away productive slots and cap adaptive mode
Summary. I tried
TUNIT_SHARED_PARALLEL_BUDGETon CI jobs that run several test processes at once on one runner. Nobody in this thread had tried it yet. It made no difference to the CPU-heavy job and made an I/O-bound suite slower, so we turned it off. Rebuilding the running-test timeline from TRX reports shows why: the budget is split equally, so a process whose extra slots buy nothing keeps them, and a process that needs them is capped. Adaptive mode can't correct this, because the part is a hard ceiling on the adaptive limit.Environment
context.Settings.Parallelism.Adaptive = true. No--maximum-parallel-tests, so the budget is 8.[ParallelLimiter<T>](non-adaptive) bound a PostgreSQL connection budget in one suite.CI results (one job per framework, test step)
Baseline: 8 recent green runs on 1.88.3 with adaptive mode on and no budget.
Suite B was slower than every baseline run in both samples. Everything else stayed inside runner noise. In the 4-lane job, most processes ran at 2–4 tests, and the critical-path process grew back to 8 as the other lanes finished. It is the longest process anyway, so the split cost it little.
Local A/B (to see the mechanism)
The 2-lane pair run together, both processes pinned to 4 cores with processor affinity,
--maximum-parallel-tests 8, adaptive on, two alternating rounds. The running-test timeline is rebuilt from TRXstartTime/endTime:[ParallelLimiter<T>]on its hosts and by host startup.Causes in the 1.90.0 source
SharedParallelBudget.GetPartgives each memberbudget / members. A process waiting in a[ParallelLimiter<T>], in a[NotInParallel]chain, or simply not benefiting from more slots keeps its whole part.MaxParallelismLimiter.ApplyusesMath.Min(_requestedLimit, _ceiling), and the budget is the fixed limit (2 × cores), not the adaptive maximum. With a budget, adaptive mode can only lower the limit, never raise it past the part. Suite B's summary says it directly:the parallel test limit stayed at 4 ... Most common reason for not raising the limit: it is the highest limit allowed, while the machine was 47% busy.TUNIT_SHARED_PARALLEL_BUDGET, joins as a member, and takes a share from the real processes. The summary saidup to 3 test processesfor a 2-lane job. Removing the variable from the child's environment fixed it, but this is easy to miss.The summaries were also confusing
the parallel test limit stayed at 8, while it never ran more than 4 to 8 (and mostly at 4). Suite B's saidstayed at 4. When a budget caps the limit, the adaptive line should give the effective limit, or say that the budget held it.Suggestions, in order of expected value
[NotInParallel]chain, could publish its idle slots for the others to take. Running tests are never interrupted, so a process taking its slots back would only have to wait for them to finish, as it does today.We have gone back to adaptive mode without a budget. As the other reports found, adaptive mode alone also never raises the limit on these runners, because the CPUs are saturated by the sibling processes and the containers.
thomhurst commentedon Nov 30, 2026
No change in CI, because a
[ParallelLimiter]was the real cap. The adaptive limiter gave unstable results.Summary. Session-wide adaptive mode made no difference to our CI. Our largest test process has an assembly-wide
[ParallelLimiter<T>]at 2, so the session limit never binds. The summary blamed the CPUs or "fewer tests are ready" instead of the limiter. When we made that limiter adaptive, the outcome varied from run to run: it went down to 1 in 7 of 8 runs, and in 4 of them never rose above 3, while fixed 2 and fixed 8 were both steady.Environment
dotnet run.ubuntu-latest(4 vCPU, 16 GB),windows-latestandmacos-latest. Each runner builds and runs several test processes at once, with code coverage.TUNIT_ADAPTIVE_PARALLELISM=1at workflow level. No--maximum-parallel-testsand no adaptive bounds.The suite
The process that matters has 5,513 tests that build and run small pipelines in process. Some start child processes, and test durations range from microseconds to about 30s. Because concurrent startup under load caused timeouts, the assembly carries
[assembly: ParallelLimiter<PipelineTestParallelLimit>]withLimit => 2. About 60 smaller test processes have no limiter and take 2–15s each.CI: one adaptive run against three earlier runs
All within runner noise. I rebuilt the number of running tests from the TRX start and end times: the largest process never ran more than 2 tests at once on any OS. The summaries did not say so:
The second line is from Windows. About 5,000 tests were ready but queued behind the limiter at 2. Locally, the session controller logged
not raising the limit of 40: the limit of a [ParallelLimiter] is being tried, but only at--log-level Debug.The processes without a limiter also stayed at 8. Most finish in under 15s. Two longer ones are dominated by a single 29s or 50s test.
Local: the limiter at 2 made adaptive
PipelineTestParallelLimitbecame anIAdaptiveParallelLimitwith start and bounds read from environment variables. Wall time of the whole process, all runs green:Note: in 6 of the 11 adaptive runs, about 30 tests in one class hit an order-dependent 5s stall inside our own code, which added 60–120s. That stall is our bug (thomhurst/ModularPipelines#7632), not TUnit's, and I left those runs out of the comparison. It surfaced only because the adaptive limiter changes which tests overlap.
Without the stall, adaptive reached fixed-8 speed when it climbed (95s, 103s). When it went down to 1 it was a third slower than fixed 2 (201s against 150s). Typical timeline (minimum 1):
The run then spent 166 of its 198s with exactly one test running. The machine was 19% busy, and no test failed.
Observations
[ParallelLimiter]. When every test waits on one limiter, the most common reason should say so, for example "5,513 tests ran behind [ParallelLimiter] PipelineTestParallelLimit at limit 2, so the session limit was not what held them back". "The CPUs have no headroom" sent us to the wrong place.AdaptiveLimiterPolicy, a lowering is tried whenever a raise is rejected. For a limiter, trying a limit below the user's start value with no CPU, memory or failure signal seems risky, because the starting value is usually a deliberate safe choice, not a guess.MinimumLimitequal to the start avoided the collapse here, so that may be worth recommending in the docs until the trial logic is steadier.Suggestions, in order of value to us
[ParallelLimiter]in the session summary, with the share of time that tests waited on it._averageTimeInside), for example several multiples of it, instead of a minimum of 1s.For reference, the tracking issues on our side are thomhurst/ModularPipelines#7633 (the limiter) and thomhurst/ModularPipelines#7634 (the 29–50s single tests). Measured for ModularPipelines in thomhurst/ModularPipelines#7630.
fix(engine): address maintainer review of the adaptive parallelism re…
feat(engine): self-managing adaptive parallelism that follows what te…
thomhurst commentedon Nov 30, 2026
1.90.1 follow-up (Reservoir): same speed as fixed, and the summary now names the real cause
Summary. This follows up on our 1.90.0 report above. On 1.90.1, adaptive mode is still no faster than a fixed limit on our CI. That is expected: the limit stayed at 8 in every process, because one keyed
[NotInParallel]chain fills about 95% of each run. The new summary line says exactly that, and it now shows up indotnet testoutput. On 1.90.0 it blamed "the CPUs have no headroom" at 31% CPU. I saw no overhead and no failures.Environment
dotnet teston Microsoft.Testing.Platform.ubuntu-latest,ubuntu-24.04-armandwindows-latest, 4 vCPU each, one job per runner. No containers.TUNIT_ADAPTIVE_PARALLELISM: 1at workflow level. No bounds, no--maximum-parallel-tests, no[ParallelLimiter<T>].mainwith a fixed limit.mainis still on TUnit 1.90.0. The 1.90.1 PR notes say the fixed path on .NET is unchanged, so I treat it as a fair baseline.workflow_dispatchwithin one minute, so they shared runner conditions.The suite
About 270 tests per process. 248 are fast in-memory concurrency tests that finish within a few seconds. The other 22 are in one class marked
[NotInParallel(nameof(BenchmarkDocsTests))]. Each of those tests startspwsh, and together they take most of the run. No parallel limit can shorten that chain.Wall clock
dotnet teststep for the main project (net8.0 + net10.0) plus the netstandard2.0 project, in seconds:Sum of the three test process durations TUnit reports, mean of 3 runs:
The ubuntu-latest gap comes from one fast runner in the adaptive set (46–50s per process) and two slow runners in the fixed set (about 69s per process). Process durations cluster by runner, not by mode. With the limit flat at 8 in every process, I read all three rows as "no difference". The useful result is that adaptive mode cost nothing here. But this suite would not show the extra-worker overhead from the Kevlar report anyway, because its parallel part lasts only a few seconds.
Summary lines
The main project, every runner and both frameworks (18 of 18 processes):
The shares ranged from 42s of 45s to 1m 17s of 1m 21s. The netstandard2.0 project gave the same line on Linux, but a lower share on Windows in all 3 runs:
The package tests (5 tests, under 1s) printed only
the parallel test limit stayed at 8.Locally (Windows, 20 logical CPUs, net10.0):
the parallel test limit stayed at 40. For 26s of 29s, tests waited for a [NotInParallel] key ("BenchmarkDocsTests" the most), which no limit changes.Good
[NotInParallel]chain. On 1.90.1 the first line says it, with the key name and its share of the run. That was our top suggestion, and it works.dotnet test. On 1.90.0 the line never reached the CI log. Now there is one line per test process, right above the result line, including when onedotnet testcall runs two target frameworks.Bad, or unclear
("BenchmarkDocsTests" the most)reads oddly. Something like(key "BenchmarkDocsTests")would fit the one-key case.dotnet testoutput, at the default verbosity. That is fine for us. If the details line is meant to show there too, it did not.stayed at 8.with no reason. I assume that is because nothing is measured in the first 2 seconds. Saying so, for example "the run was too short to measure", would avoid the question.None of this changes our conclusion: the serial PowerShell chain is the bottleneck, and adaptive mode correctly leaves the limit alone. The fix for the chain is tracked in thomhurst/Reservoir#225.
Runs
mainon TUnit 1.90.0: 46537428843, 46537441746, 46537457800Measured in thomhurst/Reservoir#224.
thomhurst commentedon Dec 1, 2026
1.90.1 on Relayer: no measurable speed change, and the summary is now visible under
dotnet testThis follows up our 1.90.0 report above ("No change: CPU-bound CI runner, limit never moved"). On 1.90.1 the
dotnet teststep was 6% faster on average than our baseline, but that is well inside runner noise. The limit still stayed at 8 in 98 of 108 test processes. The other 10 lowered it for a while and never raised it. No test failed. The biggest change for us is that the summary line now appears in the normal CI log.Environment
Same setup as the 1.90.0 report:
ubuntu-latest: 4 vCPU, 16 GB memory. Not in a container.dotnet testover a solution with 18 test projects. MTP runs 4 test processes at once.TUNIT_ADAPTIVE_PARALLELISM=1. No debug log this time, no--maximum-parallel-tests, no adaptive bounds, no[ParallelLimiter<T>], no shared budget.Wall-clock time (
dotnet teststep, per framework job)Across all 6 jobs, 1.90.1 averaged 332 s. The baseline averaged 352 s (standard deviation 43 s), and 1.90.0 averaged 348 s. Every 1.90.1 result is inside the baseline range. Per-project times were also a little lower across the board, including projects where the limit never moved, so I put this down to faster runners on the night we measured. It is not a result.
Per-project medians (seconds) for the largest projects:
The 1.90.0 slowdown that Kevlar reported (extra workers when the limit never moves) did not show here, on either version. That is expected: our tests are slow I/O tests, not short CPU-light ones.
Summary lines
All 18 lines per job now appear in the plain
dotnet testoutput, between the per-project result lines. Typical lines from one job:10 of 108 processes moved the limit. All moves were down, and all of them were in three projects: Relayer.Tests, Relayer.Kafka.Tests and Relayer.SourceGenerators.Tests. For example:
Good
dotnet test. This was our first point on 1.90.0, and it is fixed. We no longer need--diagnosticordotnet runto see whether the feature did anything.Bad, or confusing
Adaptive parallelism (Relayer.Kafka.Tests): ..., would fix this.What it means for Relayer
Our bottleneck is unchanged: a 4 vCPU runner saturated by containers, with 4 test processes at once. Adaptive mode now costs nothing and tells us so in the CI log. It still does not make the run faster.
Runs
mainon 1.87.12: 45382057313, 45378831986, 45374172543, 45372335142, 45359156928, 45354170794, 45342867222, 45340770263I can run once with
TUNIT_LOG_LEVEL=Debugto confirm why the limit was lowered, if that helps.thomhurst commentedon Dec 1, 2026
1.90.1: clear summaries, CPU-bound suite 20-40% faster, critical path unchanged
Follow-up to the 1.90.0 report, after updating Respire to TUnit 1.90.1 (#7916). Results:
[ParallelLimiter]s hold it back, not TUnit's limit.Environment
Same as the 1.90.0 report:
dotnet run.ubuntu-latest, 4 vCPU / 16 GB, about 20 parallel jobs, code coverage on.TUNIT_ADAPTIVE_PARALLELISM: 1at workflow level. No adaptive bounds and no--maximum-parallel-tests, so every process starts at 8.TUNIT_SHARED_PARALLEL_BUDGETis not set.[ParallelLimiter<T>]and[NotInParallel]attributes are unchanged. The only change from the 1.90.0 runs is the package version.Timing
Baseline: three
mainruns on TUnit 1.87.12 (fixed limit). Then two 1.90.0 runs and two 1.90.1 runs, all adaptive. The second 1.90.1 run is a rerun of the first.main, 1.87.12 fixedNote: other workflows in the repository took the runners during both 1.90.1 runs. In the first run, the final gate job waited about 10 minutes for a runner. In the rerun, jobs started up to 20 minutes late, so it has no usable wall clock. Each job runs on its own VM, so the per-process durations are still comparable.
Reading the table:
The summary lines now
The largest process, in each run:
The analyzer tests:
A job that runs several test processes and Redis containers at once:
Most other processes print one line, for example:
The five points from the 1.90.0 report
[NotInParallel]tests (6-7 min) and ourTimingSensitivelimiter (6-7.5 min) set its length, not the limit. Short processes still never move, which is expected.ElasticLaneexplain most of it.TUNIT_SHARED_PARALLEL_BUDGET.Good
[NotInParallel], a[NotInParallel]key, a[ParallelLimiter]or the CPU holds back. It also explains why our critical path will not get faster from adaptive mode alone.[ParallelLimiter]line is the most useful addition. It shows ourTimingSensitivelimiter (limit 2) held tests for 6-7.5 minutes in the largest process, with the CPUs about 25% busy. That is a clear lead for us.[NotInParallel]key ("signalr-integration", "shared-redis-cluster-resharding") points straight to the group.Bad, or confusing
[ParallelLimiter]advice repeats. Every limiter line ends with the same two sentences ("Adaptive parallelism never raises a declared limit. If it is not a hard cap..."). They make up about half of each line. Once per run would be enough.TimingSensitivelimiter and the serial tests next.Runs
main, 1.87.12: 46259195307, 46253433108, 459340824474 remaining items
thomhurst commentedon Dec 1, 2026
Follow-up: our hook semaphore is now a
[ParallelLimiter], and the summary names itFollow-up to our 1.90.1 report (Dekaf). That report said our
SemaphoreSlim(4)in a[Before(Test)]hook was invisible to TUnit, and that we would replace it with a[ParallelLimiter<T>]. We did that in Dekaf#4267. Still TUnit 1.90.1, same runners, same adaptive settings. Three more CI runs were all green.Short version: the summary now gets the cause right. Wall-clock time did not change, which we expected: the cap is still 4.
What we changed
[ParallelLimiter<KafkaFixtureParallelLimit>]withLimit = 4. It replaces the hook semaphore and a second, redundant semaphore of 4 for transaction tests.What the summary says now
The consumer-groups process, which said "Tests waited for it for 2m 48s of 3m 4s, with the CPUs 8% busy; it was not raised mostly because throughput kept changing between measurements", now says:
That is exactly what we wanted. It names the real bound and says plainly that the TUnit limit is not the problem. The other five consumer-groups summaries say the same, with waits of 2m 51s to 3m 2s and the CPUs 11-18% busy.
Across the whole run, the change is large. In each run, 58 test processes print a summary line. Before the change (1.90.1 run 3), 28 of them said tests waited for the TUnit limit. After the change, 9 do in every run, 27 name the limiter, and 22 name a
[NotInParallel]key. The produce process is a good example. It used to say tests waited for the limit for 1m 23s with the CPUs 46% busy, and the limit moved between 6 and 8. Now it names the limiter for about 1m 25s.Of the 9 processes that still blame the TUnit limit, 7 are integration processes with busy CPUs (69-86%). The other 2 are the unit processes, which do not use the limiter. Slots no longer fill with tests that wait on our semaphore.
The limiter line also gives the wait time and CPU load in one sentence. That makes the choice clear: 3 minutes of waiting at 12% CPU says the cap costs time, so it is up to us to decide whether 4 is still the right number.
Wall clock
Time of the "run tests" step, in seconds. "Fixed" is two green fixed-limit runs of the #4267 head (same TUnit, same limiter, adaptive off). It is the closest control we have. No
mainCI run has finished since the merge.Do the earlier asks still matter?
[NotInParallel], raises rarely sticking, CPU figures under affinity) are unchanged by this work.Runs
HookCollectionService#4267 head): run 1, run 2thomhurst commentedon Dec 1, 2026
Follow-up: our declared
[ParallelLimiter]s were the real cap. Raising them helped where adaptive mode could not.After the 1.90.1 reports above, the new
[ParallelLimiter]summary line kept pointing at our own limiters, not at TUnit's limit. So we tested raising or removing two of them on CI. Both runs used TUnit 1.90.1. This is early data for Dekaf (2 rounds of 3 so far), so treat it as preliminary.Short version: in both repos a limiter set years ago "to be safe" cost real time, at low CPU. The 1.90.1 summary made that obvious. Adaptive mode correctly never raises a declared limit, so it could not find this on its own.
ModularPipelines:
PipelineTestParallelLimit2 → 4 (merged)Context: our earlier report. The limiter was added to stop start-up timeouts on busy 4-vCPU runners. We ran limits 2, 4 and 8, three runs each, started together in each round. Median duration of the largest test process (5,513 tests), in seconds:
Dekaf:
KafkaFixtureParallelLimitat 4, 8, and removed (in progress)Context: our limiter follow-up. The limit of 4 per broker came from an earlier failure (
FindCoordinator for transaction failed after 5 retrieson a loaded workstation). Its cause was never identified. Adaptive mode was on in every run here."Run tests" step, seconds, rounds 1 and 2:
[NotInParallel], so total CI time did not change.What adaptive mode did once the limiter was gone (consumer groups, net10.0):
That looks right to us. It tried 12, saw no gain, and went back to 8. 8 is also where the gain stopped in our fixed trial.
At limit 8 the limiter line read:
[ParallelLimiter] KafkaFixtureParallelLimit: the limit stayed at 8. Tests waited for it for 52s while the CPUs were 16% busy.That is down from about 3 minutes at limit 4.Two unit test failures, both outside the limiter
Neither is caused by the limiter change, because our unit tests do not use it. I include the second because it fits item 1 of our 1.90.1 report (lowering into idle time):
InvalidOperationException). That is our bug.[Timeout]. Just before it, the log shows:What this means for adaptive mode
[ParallelLimiter]line is the most useful part of 1.90.1 for us. "Tests waited for it for 2m 57s while the CPUs were 12% busy" led straight to both changes above.IAdaptiveParallelLimitalready does for throughput. With that, we would set a floor (Minimum = 4) and let TUnit find the rest.Runs
I will add the third Dekaf round if it changes anything.
thomhurst commentedon Dec 1, 2026
Dekaf round 3 is in, and it confirms the earlier results.
FindCoordinator,COORDINATOR_NOT_AVAILABLE,NOT_COORDINATORor integration timeouts. Dekaf does not retry tests.We are raising the limit to 8 rather than removing it (thomhurst/Dekaf#4271). On a 4-vCPU runner, 8 holds nothing back. On larger machines the session limit starts much higher, and that is where the original failure happened.
Round 3 runs: limit 4, limit 8, no limiter
fix(engine): act on 1.90.1 adaptive parallelism feedback (#7923)
thomhurst commentedon Dec 1, 2026
Reservoir on 1.90.2: same time, clearer summary
Three adaptive runs on 1.90.2 (thomhurst/Reservoir#224) ran at the same time as three fixed-limit runs of
main(1.90.1). All 18 jobs passed."Test" step + "netstandard2.0" step, seconds:
mainNo difference beyond runner noise. That is expected: almost all test time is a serial
[NotInParallel]chain of PowerShell doc-script tests.What 1.90.2 fixes for us: the summary now says exactly that, and each line names the project and target framework:
Both lines are correct and actionable. With several test processes under one
dotnet test, the project name makes the output easy to read. I saw no misleading wording in any of the 36 summary lines.Runs: adaptive 46691548511, 46691565092, 46691577699; fixed 46691556784, 46691571538, 46691583821
thomhurst commentedon Dec 1, 2026
Reservoir follow-up: removing our
[NotInParallel]cut test time by 46%. Adaptive and fixed limits are equal.The 1.90.2 summary named the
[NotInParallel]key "BenchmarkDocsTests" as the bound. We checked why we had it. The comment said "simultaneous PowerShell cold starts can exhaust hosted runners". Each case uses its own temp directory and shares no state, so it was load protection only. We removed it to let the limit decide."Test" + "netstandard2.0" steps, seconds. All three branches ran at the same time, with three runs each. All passed.
main(fixed limit, with[NotInParallel])[NotInParallel][NotInParallel](The adaptive column has two batches of three runs. The first batch ran next to
main, the second next to the fixed control.)Summary lines are correct. They now blame the limit and full CPUs, not a
[NotInParallel]key:Small wording point: some lines that moved and came back end with no reason, for example
... (lowest 6, highest 8, 2 changes, 1 put back). Tests waited for it for 16s of 41s, with the CPUs 100% busy.In this case "the CPUs had no headroom" is implied, but other lines state it.Takeaway for other users: the
[NotInParallel]line in 1.90.2 points straight at serial chains worth checking. Ours existed for load protection, which is the job adaptive mode now does.Runs:
main46693985428, 46693997056, 46694011422; adaptive 46693978603, 46693990444, 46694004204, 46695555090, 46695567132, 46695579113; fixed control 46695560948, 46695573164, 46695585758thomhurst commentedon Dec 1, 2026
A private ASP.NET/Aspire app on 1.90.2, with its Postgres parallel limiters removed: same wall-clock time, saturated runners
This is a private app: ASP.NET, Aspire, Postgres in Testcontainers, and Playwright E2E tests. We removed every load-only throttle from its backend suites: 99
[ParallelLimiter]s, at limits of 4 and 33. Every limited class works on its own cloned database, so the limiters only capped Postgres connections and CPU. We raised the test Postgresmax_connectionsto 1000 so that connections cannot be the bound. The only throttle left is a keyed[NotInParallel]on 3 tests that change server-level grants.Three rounds. In each, the branch (1.90.2, adaptive, no limiters) ran at the same time as
main(1.90.0, adaptive, with the limiters). All 6 runs passed with no test failures. Suite step, seconds:main, 1.90.0, limitersNo difference overall. Integration was slower on the branch in 2 of 3 rounds, by 24 s on average, but it overlaps
main's range.Why: the CPUs are the bound, and the summary says so
The backend jobs run several test processes at once on 4 vCPUs. Nearly every summary line says the CPUs were 100% busy, mostly from other processes:
This is correct, and the 1.90.2 lines make it easy to see. Removing the limiters gave the scheduler room it could not use, because the machine had none to give. The useful finding for us is that the limiters were not costing time either. With the limiters gone and
max_connectionsraised, the code is simpler and nothing got slower.E2E smoke (8 vCPU, Playwright) went 16 → 8 for saturated CPUs. Its child processes, the browsers, used 55% of the machine. It tried 12 twice and put it back for no gain. That looks right.
Small wording points
the parallel test limit stayed at 8. Tests waited for it for 29s of 35s, with the CPUs 100% busy.and... for 1s of 4s, with the CPUs 100% busy.Other lines from the same job add "it was not raised mostly because the CPUs had no headroom". We saw the same in Reservoir.Tests waited for it for 21s of 28s, with the CPUs 100% busy; too few measurements completed to try a raise.With the CPUs at 100%, "the CPUs had no headroom" is the more useful reason, even if too few measurements were also true.thomhurst commentedon Dec 1, 2026
Relayer on 1.90.2: still no speed change. The summary is right, with one headline that hides a memory lowering
Same setup as our earlier reports: 18 test projects under
dotnet teston 4-vCPUubuntu-latest, with Postgres, SQL Server, MySQL, Kafka, NATS, RabbitMQ and Pub/Sub in Docker. Relayer has no[NotInParallel]or[ParallelLimiter], so there was nothing to remove. This time the control is fair: we movedmainto 1.90.2 (fixed limit), and each round ran one adaptive and one fixed run at the same time.Teststep, seconds:No difference. All 12 jobs passed. Before these rounds, one adaptive run failed in a Kafka test with a 200 ms stop deadline (
Partition processor ... did not stop within 00:00:00.2000000). The limit had stayed at 8, so the deadline is ours to fix. A fixed-limit run also hit a timeout in a Postgres change-capture test, so both look like our own flaky tests.Summary lines
101 of 108 processes stayed at 8. Most say "the CPUs had no headroom; most of their load came from other processes or containers". That matches what we measured earlier, with containers using most of the CPU. Naming the containers is a good addition, and so is the
(93% busy at those times)figure on the lines where it differs.One misleading headline. Three processes were lowered for memory pressure, but the headline gives only the CPU reason:
A reader of the headline sees "went from 8 to 4" next to the CPUs. Then the details line says CPU saturation from other processes "is no reason to lower the limit". It takes the
Changes:part to find that memory caused it. Two suggestions:memory load 12%). These are 16 GB runners with seven database and broker containers, so we would like to know how high it was.The other two memory lowerings ended at 4 too: Pub/Sub, 4 for 18s of 26s, and source generators, 4 for 27s of 1m 29s. Three more processes lowered for memory and came back up.
Two lines end with no reason (
... with the CPUs N% busy.), the same as in the Reservoir and private-app reports above.Runs, adaptive / fixed: round 1 46703310566 / 46703268303, round 2 46705963023 / 46705968526, round 3 46708568698 / 46708574696
thomhurst commentedon Dec 1, 2026
Dekaf on 1.90.2: removing load-only throttles cut test time by 18%. Adaptive matches fixed overall and is slightly faster on unit tests
Following the earlier limiter results, we went further. Every
[NotInParallel]and[ParallelLimiter]in Dekaf was checked against one rule: keep it only if the tests share mutable state.KafkaFixtureParallelLimit, about 92 of 141 bare and about 51 of 124 keyed[NotInParallel]. That includesShareConsumerKafka42, which serialised all share-consumer tests."Run unit tests" + "Run integration tests", summed over 20 jobs:
main(1.90.1, fixed limit, all throttles)What the summary got right
The longest job is now bound by a real conflict, and the line names it:
The project and framework in each line make 20 jobs easy to scan.
Two things that look off
1. Integration lanes never try a raise at low CPU. Several lanes wait for the limit for most of the run with the CPUs at 14–16%, and every one gives "throughput kept changing" as the reason:
These tests wait on a Kafka broker, so throughput is noisy by nature. On 1.90.1 with the limiter removed, the same lane tried 12, saw no gain, and went back to 8. That was a fine outcome. On 1.90.2 it doesn't try at all in any of 6 jobs. The hint also points at "a lock, a fixture or an external service". Here it is the external service, which is true but expected for integration tests. When tests wait on the limit for over half the run at low CPU, one trial raise despite noisy throughput seems worth its cost.
2. Unit tests lowered "for saturated CPUs" at about 45% average CPU. In both unit jobs, 2 lowerings to 6 were for saturated CPUs. On net10.0 it spent 38 s of 77 s at 6. The run averaged 43% CPU, and this process used almost all of that. Each lowering may have been right for its own sample, since the unit suite has CPU-heavy bursts. Still, it is the same pattern as item 1 of #7923, which was meant to stop lowering on a half-idle machine. Adaptive was still faster than fixed here, so this costs little.
Test bugs that removing the throttles exposed
All were ours, and most were races the throttles had hidden. They failed in both adaptive and fixed runs, so they are not caused by the mode.
[NotInParallel], which we restored.One integration test (
Consumer_TopicRecreatedWithFewerPartitions_DropsVanishedPartition) hung for 2 minutes once, in a fixed-limit run. It uses unique topics and groups. We are watching it.Runs:
main46711910679, 46711928463, 46720576677; adaptive 46711905215, 46711923986, 46725370766, 46734154789; fixed control 46725376374, 46730052916, 46734160801. PR: thomhurst/Dekaf#4262thomhurst commentedon Dec 1, 2026
Kevlar on 1.90.2: removing load-only
[NotInParallel]cut test steps by about 13%. Adaptive matches fixed. The suites are too short for adaptive to matterKevlar is a resilience library with many short unit suites. We checked all 96
[NotInParallel]against one rule: keep it only if the tests share process-wide state. 63 were removed. 11 classes were narrowed to the methods that conflict. About 22 were kept, for process-wide listeners, metric enrichers, no-GC regions, callback-error hooks and allocation gates.Each round ran three branches at the same time: the PR (adaptive, throttles removed), a fixed-limit control of the same code, and
main(1.90.1, fixed, all throttles). Test steps, seconds, counting only jobs whose tests completed:mainThe run was too short to measure.That is a good, honest line. The rest say the CPUs had no headroom, and the(94% busy at those times)figure helps where the average was 67–79%.The 1.90.0 issue we reported earlier (extra workers making short suites slower when the limit never moves) did not show up here.
Test bugs exposed: removing the throttles turned up two kinds of problem. Both failed with adaptive mode on and off, so they are ours, not TUnit's:
CancelledorOK.mainalso had one unrelated flaky failure.Runs, round 1 / 2 / 3:
main: 46747671781, 46750042859, 46752093681PR: thomhurst/Kevlar#754
thomhurst commentedon Dec 1, 2026
Respire on 1.90.2: removing load-only throttles cut test time by 25%. Adaptive matches fixed
Respire is a Redis client with about 30 test jobs, many using Redis, cluster and Sentinel containers. We checked every throttle against one rule: keep it only where tests share mutable state.
[ParallelLimiter]s: 52TimingSensitive, 27DockerHeavy, 8ChildProcessProbes, 1ContainerTopology, and an assembly-wide limit of 2 on the streaming tests.[NotInParallel].--maximum-parallel-tests 2in one workflow.About 1,023 tests ran serialised before; about 692 do now.
Each round ran three branches at the same time: the PR (adaptive, throttles removed), a fixed-limit control of the same code, and
main(TUnit 1.87.12, fixed, all throttles). Test steps summed over all jobs, in seconds:mainComplete runs average 2996 s on
main, 2245 s fixed and 2198 s adaptive. The 25% gain comes from removing throttles. Adaptive is 2% faster than fixed, which is within noise. The biggest per-job changes:mainSummary lines
Most processes say "the CPUs had no headroom; most of their load came from other processes or containers", at 95–100% CPU. That is right for jobs that run several test processes next to Redis containers.
The same two patterns we reported for Dekaf appear here too:
Two streaming lines end with no reason (
... with the CPUs 99% busy.). We saw the same in other repos.Failures
There were 2 failures in 9 runs, one in each throttle-free branch, and neither shows shared state:
[NotInParallel], so we suspect leftover background work from earlier tests, not the scheduler.We are watching both.
Runs (adaptive / fixed /
main):PR: thomhurst/Respire#2807
thomhurst commentedon Dec 2, 2026
Summary of the 1.90.2 round, and ideas for speeding up test runs
Six projects tested 1.90.2. In each, adaptive mode was compared with a fixed-limit control of the same code, run at the same time. Results are in the comments above.
Adaptive mode never cost time in 1.90.2. That is a good result. But every real speed-up came from removing our own
[NotInParallel]and[ParallelLimiter]attributes. Most had been added "to be safe" or for load. The 1.90.2 summary lines are what led us to them. So the biggest lever is helping users find and remove serialisation they don't need. Ideas, most impactful first:1. Report what each throttle costs
The headline names the top
[NotInParallel]key, and that alone found Reservoir's 46%. A full end-of-run report would find the rest:[ParallelLimiter]and bare[NotInParallel], with the time tests waited on it, the CPU % while they waited, and how many tests it serialised.[NotInParallel]flagged on its own line, because it blocks every other test, not just its group.For example, "
ShareConsumerKafka42serialised 56 tests for 6m at 15% CPU" would have pointed straight at Dekaf's biggest win.2. A mode that ignores constraints, to audit them
For each repo we checked every attribute by hand, ran without it, and saw what failed. A built-in option could automate that, for example
--ignore-parallel-constraints --repeat 5. It would run with keys and limiters off and list the tests that fail only in that mode. Those are the attributes worth keeping.In our runs, the ones that really mattered fell into three groups:
MeterListenerorActivityListener.3. Start the critical path first
Our longest jobs are each bound by one serial chain. In Dekaf,
[NotInParallel("RackAwareKafkaContainer")]takes 10 of 11 minutes. If TUnit saved each test's duration from the previous run, it could start keyed chains and long tests first, so they overlap with everything else. That would shorten the tail without raising any limit.4. Try a raise when throughput is noisy but CPUs are idle
Integration lanes in Dekaf and Respire wait on the limit for 50–70% of the run at 15–35% CPU. Every raise is blocked by "throughput kept changing between measurements". These tests wait on a broker or Redis, so throughput is noisy by nature. 1.90.1 tried 12 here, saw no gain and went back, which was fine. 1.90.2 never tries. Two options:
5. Lower only on sustained saturation
Dekaf's unit suite, which averaged 43% CPU, and an Orleans suite in Respire, which averaged 12%, were both lowered "for saturated CPUs" on short spikes. Requiring saturation over several samples, or a minimum average, before lowering would avoid this. It is the same case as item 1 of #7923.
6. Wording
... with the CPUs 99% busy.and nothing after it.7. Coordination across processes (a bigger change)
On 4-vCPU runners that run several test processes and containers together, most of the load comes from siblings. Each process adapts on its own, so all it can say is "no headroom". Two possible fixes:
--max-parallel-test-modules) adaptive.Thanks for the quick turnaround on #7923. The project-named summary lines alone made this round of measurement much easier.
thomhurst commentedon Dec 4, 2026
TUnit 1.90.4 follow-up to #7938
Seven production repos ran their existing CI one at a time. Adaptive parallelism was on for both versions. We found no repeatable whole-workflow speed-up. The clearest repeatable improvement was one 6,150-test generator process, 12–15% faster across two pairs. The private app’s 509-test E2E step also improved in its one pair, but an Android build determined the workflow finish. ModularPipelines had the largest observed workflow slowdown, 36m58s to 43m17s in a single successful pair.
The new diagnostics answered two questions the old output left open. Dekaf’s busiest key had 205.85 seconds of contention with slots free, but only 0.962 seconds where earlier admission of a queued holder could help. On short CPU spikes, the new details now show how busy the process and its children were at the lowering decision. The remaining feedback from Respire is to distinguish an exploratory raise on noisy throughput from an ordinary raise in the summary.
Reservoir
The first matched pair showed no CI speed-up. Across Linux x64, Linux Arm64, and Windows x64, the two TUnit test steps per runner took 255 seconds combined on 1.90.2 and 333 seconds on 1.90.4. The longest runner’s test steps took 94 and 118 seconds respectively. Whole-workflow elapsed time, including runner queues, build, and packaging, was 5m21s and 7m52s. Both runs passed. Only the three TUnit package pins changed. Both ran with adaptive parallelism enabled and the same test constraints. Control run · 1.90.4 run
Six earlier runs of the exact control commit ranged from 305 to 343 seconds of combined test steps. The fresh control was unusually fast, so this pair alone cannot establish a regression. Earlier controls
The new CPU diagnostic answers a question from the previous round. On Linux x64, the .NET 8 suite averaged 74% machine CPU. The lowering decision saw 2.55 seconds of saturation at 100% CPU, with the test process and its children using 75% of capacity. The limit fell from 8 to 6 and returned to 8. The Arm64 run recorded 2.03 seconds at 100% CPU, with the process and children using 97%. Showing the decision window alongside the average makes those reductions understandable. 1.90.4 job logs
The repeat finished 5 seconds earlier on 1.90.4 (6m14s versus 6m19s). Combined test steps took 353 versus 357 seconds, with the longest runner at 146 versus 144 seconds. Both passed. The first pair’s slowdown did not repeat. Reservoir shows no reproducible CI speed-up or slowdown from the upgrade. Repeat control · Repeat 1.90.4
Kevlar
Both full workflows passed. The selected TUnit test steps plus the allocation gate took 204 seconds on 1.90.2 and 190 seconds on 1.90.4. Windows improved from 88 to 72 seconds, Linux went from 62 to 70 seconds, and the allocation gate went from 54 to 48 seconds. Whole CI took 13m32s and 14m44s respectively, including build, coverage, and runner queues. The new test total is inside the earlier adaptive range of 188–234 seconds. This pair does not establish a CI speed-up. Control · 1.90.4 · Earlier trials
We also tried
--parallel-constraint-reporton the same .NET 11 binary, fixed first and adaptive second on one Linux runner. All 1,878 tests passed in both processes. The report separated 80 globally exclusive tests from individual keys. ForKevlarActivityListener, holder wait with tests behind it was 133 ms fixed and 3 ms adaptive. A different key,MetricsTests.CustomStrategyEvent, went the other way (79 ms and 159 ms). Both keyed rows showed zero sampled time with free slots. The separate holder-wait field exposed contention that the free-slot ranking alone would miss. One run per mode, in fixed order, is insufficient to attribute either timing change to the scheduler. Constraint-report jobRelayer
Both workflows passed. Whole CI took 13m14s on 1.90.3 and 13m49s on 1.90.4. Summed across the .NET 10 and .NET 11 test steps, the times were 746 and 734 seconds (1.6% lower). The wall time includes runner queues and non-test jobs. Adaptive parallelism was enabled on both versions. Only the TUnit package pins changed. .NET 10 took 355 s and 397 s. .NET 11 took 391 s and 337 s. One paired run gives an initial estimate. More runs would establish its repeatability. Control · 1.90.4
On 1.90.4, 35 of 36 test processes stayed at the initial limit of 8. The .NET 10 source-generator suite briefly fell to 6 and returned to 8 after 10 seconds. Its diagnostic reported 0.52 seconds of saturation at 100% CPU, with the test process and children using 63% of capacity at the decision. The process averaged only 11% CPU across the run. This gives a concrete example for evaluating how long saturation should persist before lowering. Source-generator job
We excluded the original 1.90.3 dispatch after two RabbitMQ conformance tests exceeded their fixture cleanup budgets. Starting the fresh control superseded the unfinished workflow. The failed .NET 10 job finished before that cancellation. An earlier successful push of the identical control commit took 288 and 357 seconds for its two test steps. Failed control job · Earlier successful control
Private ASP.NET/Aspire app
Both workflows passed. Whole CI took 16m42s on 1.90.3 and 16m35s on 1.90.4. Summed across the fast backend, integration backend, and both end-to-end test steps, the times were 1,302 and 1,163 seconds (10.7% lower). The wall time includes runner queues and non-test jobs. Adaptive parallelism was enabled on both versions. Only the TUnit package pins changed. Fast backend took 429 s and 421 s. Integration backend took 238 s and 235 s. E2E smoke took 635 s and 507 s. One paired run gives an initial estimate. More runs would establish its repeatability.
In one integration process, the new headline explicitly attributed the final reduction from 8 to 4 to CPU saturation. The details showed 54% peak memory, and the last lowering followed 0.52 seconds at 99% machine CPU, with the process and children using 62% of capacity. Tests waited for slots for 222 of 229 seconds. Separating the signal that lowered the limit from the machine-wide average makes a busy shared runner easier to interpret.
Across all 13 allocated jobs, the control used 249.0 vCPU-minutes and the trial used 227.5 (8.6% fewer), measured from actual runner labels and job durations. An Android build finished last in both workflows. The larger E2E session passed all 509 tests on both versions. Its CI step fell from 588 to 456 seconds (22% shorter) in this pair. Both controllers started at 16, ended at 8, and reported 90% CPU while tests waited for slots. That is a promising single observation. The limit range alone does not explain it.
Respire
Both workflows passed. Whole CI took 15m46s on 1.90.2 and 16m57s on 1.90.4. Summed across the unit, integration, analyzer, component, smoke, and StackExchange compatibility test steps, the times were 1,877 and 1,847 seconds (1.6% lower). The wall time includes runner queues and non-test jobs. Adaptive parallelism was enabled on both versions. Only the TUnit package pins changed. One paired run gives an initial estimate. More runs would establish its repeatability. Control · 1.90.4
The first .NET 11 StackExchange compatibility process is a useful noisy I/O example. The control held 8 slots for its 21-second run, with 31% CPU while waiting and changing throughput. On 1.90.4 it tried 12 slots, spent one second there, then returned to 8 because the CPUs became busy. That run took 23 seconds, with 34% CPU while waiting. The next invocation ended at 12 and took 16 seconds on both versions. The 1.90.4 details say “raised to try more tests”. Could that line identify when the noisy-throughput exploration path triggered the raise? It would let a CI user verify which policy was exercised from the ordinary summary. Control job · 1.90.4 job
The longest test lane, networking unit tests, took 13m06s on the control and 12m31s on 1.90.4. Control networking job · 1.90.4 networking job
Dekaf
Both workflows passed. Whole CI took 18m53s on 1.90.3 and 19m10s on 1.90.4. Summed across the unit and grouped integration test steps across .NET 10 and .NET 11, the times were 5,048 and 5,040 seconds (0.2% lower). The wall time includes runner queues and non-test jobs. Adaptive parallelism was enabled on both versions. Only the TUnit package pins changed. One paired run gives an initial estimate. More runs would establish its repeatability. Control · 1.90.4
The last gating job in both workflows was the NativeAOT integration smoke. Its test step took 12m26s on the control and 11m47s on the candidate. The candidate job started its test step one minute later. Control AOT job · Candidate AOT job
The separate constraint-report run used the 1.90.4 candidate’s compiled .NET 11 binaries and the production resilience filter. All 116 tests passed in 4m37s. The report ranked the RackAwareKafkaContainer key first: 17 tests observed, 205.85 seconds of contention with session slots free at 21% CPU, but only 0.962 seconds with a key holder queued for a session slot while tests waited behind it. One globally exclusive test accounted for another 15.375 seconds with slots free. The controller tried 12 slots for 34 seconds and returned to 8 for lack of throughput gain. The report distinguishes time blocked on the shared Kafka fixture from the much smaller opportunity to schedule a key holder sooner. Constraint-report job
ModularPipelines
Both workflows passed. Whole CI took 36m58s on 1.90.3 and 43m17s on 1.90.4. Summed across the full-pipeline steps, which include build and orchestration as well as tests, the times were 7,585 and 9,913 seconds (30.7% higher). The wall time includes runner queues and non-test jobs. Adaptive parallelism was enabled on both versions. Only the TUnit package pins changed. One paired run gives an initial estimate. More runs would establish its repeatability. Control · 1.90.4
Both original manual dispatches hit the same GitVersion failure in the package-version module. We excluded those whole-workflow times. The comparison above repeats the original commits with the same supported rehearsal input on both branches,
prerelease-version=4.0.54-rc.1, and publishing disabled. Original control failure · Original candidate failureBefore that failure, the CPU-bound OptionsGenerator process passed all 6,150 tests on both versions. Its reported duration fell from 3m16s to 2m46s. Both controllers started at 8 and reached 4. The control ended at 6 and the candidate at 4. The candidate’s final CPU lowering recorded 0.56 seconds of saturation, 95% machine CPU and 90% of capacity used by the process and children. The entire prerequisite job still took 10m58s and 10m56s, respectively. This shows why a faster test process does not necessarily reduce feedback time for the workflow. Control prerequisite job · 1.90.4 prerequisite job
The rehearsal reproduced the process-level improvement on the same 6,150 tests: 3m06s on 1.90.3 and 2m44s on 1.90.4 (12% shorter, after 15% shorter in the first pair). Rehearsal control job · Rehearsal candidate job
The six distributed workers overlap and wait on one another, so their summed times are not six independent samples. The slowest full-pipeline step took 21m31s on the control and 28m16s on 1.90.4. Both macOS jobs used the same macOS 26 Arm64 image revision, but the main unit suite reported a session limit of 10 throughout the control and 6 throughout the candidate. It spent 65 of 125 seconds versus 118 of 186 seconds waiting for the same declared pipeline limiter. The whole-workflow slowdown is real for this pair. These observations do not isolate its cause to TUnit. Control macOS job · Candidate macOS job
thomhurst commentedon Dec 5, 2026
TUnit 1.90.5 follow-up to #7941
Seven repositories tested. We found no consistent whole-CI speed-up. Across 299 process summaries per version, 19 of 24 reported last CPU lowerings on 1.90.4 followed less than five seconds of saturation. None of the 10 reported on 1.90.5 did. The new exploratory-raise reason appeared in ordinary Respire and Dekaf logs. A CPU-heavy generator suite ran 6.8% faster by median on one runner, but slower in both full CI pairs on separate runners. The Aspire adapter also exposed a MessagePack compatibility problem, described below.
Both versions ran with adaptive parallelism enabled. Each pair used the same source, workflow, inputs, and test constraints. Only the TUnit package versions changed. Workflow elapsed time includes queueing, build, and packaging. Test-step totals sum matching steps across parallel jobs.
For ModularPipelines, the selected steps include distributed build and orchestration. The six workers overlap.
CPU saturation before lowering
We inspected summaries in the selected CI jobs. Each process can report its last CPU-triggered lowering. The table counts those diagnostic lines and gives their range. A process can lower multiple times.
Reservoir finished 11 seconds later in the first pair and 24 seconds earlier in the repeat. Neither a CI speed-up nor a slowdown repeated. On Reservoir’s Linux runner, 1.90.5 lowered the .NET 8 process from 8 slots to 6 after 8.92 seconds at 99% machine CPU. The process and its children used 81% of capacity. TUnit later restored the limit to 8. The longer window still allows a reduction during sustained load. Job log
Relayer’s 36 test processes held the starting limit of 8 on both versions. The .NET 10 test step took 375 and 316 seconds. The .NET 11 step took 381 and 383 seconds and set the longer test lane in both runs. The full workflow finished 9 seconds later on 1.90.5. Control · Trial
We excluded the first Relayer pair from whole-workflow timing. The 1.90.4 .NET 10 transport conformance test exceeded its 15-second fixture-disposal budget during the outage scenario. The paired 1.90.5 workflow passed in 9m50s. Both commits were dispatched again without changing any tests. Failed control job · First 1.90.5 run
Kevlar finished one second later on 1.90.5. Its 24 selected test steps also totalled one second more. The Windows test steps fell from 92 to 85 seconds, Linux went from 56 to 57 seconds, and the allocation gate went from 59 to 66 seconds. Neither version reported a CPU-triggered lowering in the sampled jobs. Control · Trial
Aspire compatibility: A private .NET 11 application could not run its full suite with all TUnit packages on 1.90.5. Its central MessagePack 3.1.12 pin caused NU1109 because TUnit.Aspire.Core 1.90.5 requires MessagePack 4.0.0. Updating the test host to MessagePack 4 made restore succeed, but all three targeted SignalR configuration tests failed with TypeLoadException when loading a formatter compiled against MessagePack 3. The missing type was MessagePack.Formatters.IMessagePackFormatter. This happens before a scheduler timing comparison is possible. Could the Aspire integration remain compatible with the MessagePack major used by existing SignalR applications? The failing runs are excluded from the timings. TUnit.Aspire.Core dependency change
Keeping only TUnit.Aspire and TUnit.Aspire.Core on 1.90.4 restored compatibility. The process loaded TUnit.Engine 1.90.5 from the #7941 merge commit, and all 26 focused serialization and SignalR configuration tests passed. The new timing run uses that package combination and the original 1.90.4 control.
The corrected run finished in 13m14s versus 15m37s on the control. Across 13 allocated jobs, runner time was 217.2 versus 222.3 vCPU-minutes (2.3% lower). The integration test step fell from 272 to 190 seconds, while the two E2E steps rose from 466 to 510 seconds combined. An Android build finished last on both versions and took 1m54s less in the trial. The control started 9m39s before the corrected trial. This single pair cannot attribute the 2m23s workflow gain to the scheduler.
Respire confirmed the new diagnostic in real CI. The .NET 11 networking suite reported six ordinary raises and one exploratory raise. The .NET 10 smoke suite spent one second at 12 slots before returning to 8 and reported the following reason in its normal run output. Networking job · Smoke job
Across 54 process summaries per version, five of the six reported last CPU lowerings on 1.90.4 followed less than five seconds of saturation. The two on 1.90.5 followed 6.26 and 13.05 seconds. The networking test step fell from 636 to 580 seconds, but its runner started 16m33s and 18m03s after dispatch, respectively. Total CI finished 15 seconds later on 1.90.5. The diagnostics changed as intended without a workflow speed-up in this pair.
In Dekaf, five of 56 control process summaries recorded a last CPU lowering, all after just 0.50–0.52 seconds of saturation. None of the 56 on 1.90.5 recorded one. Four candidate summaries identified an exploratory raise. The 20 selected test steps used 108 fewer seconds combined, but whole CI took 29 seconds longer. The NativeAOT smoke finished last on the control, and the .NET 11 messaging job finished last on the candidate. Control · Trial
ModularPipelines generator suite, controlled measurement. In the first full CI pair, all 6,150 generator tests passed in 185.6 seconds on 1.90.4 and 206.1 seconds on 1.90.5. The last CPU lowering followed 0.50 and 19.68 seconds of saturation, respectively. Later in that trial, five distributed build workers stopped after losing contact with the coordinator. We excluded the incomplete workflow from the elapsed-time comparison and repeated the rehearsal. Control generator job · Trial generator job · Worker log
To check the apparent process slowdown, we built both commits once on one Ubuntu runner and ran six fresh processes with the same coverage settings and adaptive mode. In execution order the times were 123.4 s (old), 114.3 s (new), 115.1 s (new), 115.8 s (old), 131.9 s (old), 117.4 s (new). All six runs passed all 6,150 tests. The median fell from 123.4 to 115.1 seconds (6.8%). The new version was faster in all three adjacent pairs on this runner. The initial slowdown on separate runners did not reproduce. Same-runner comparison
The generator ran slower on 1.90.5 again in the second full CI pair: 145.2 seconds on 1.90.4 and 191.9 seconds on 1.90.5. In both full pairs the candidate prerequisite job was also slower before the generator step started (327 versus 423 seconds, then 299 versus 328 seconds). In the second pair the new controller tried reducing to 6 four times and restored 8 each time. These production observations and the opposite same-runner result leave the cause unresolved. Second control · Second trial
The second 1.90.4 rehearsal also had an independent failure. Its Windows command regression suite passed all 13 tests; the subsequent PowerShell startup probe exited with code -1073741502. For successful whole-workflow timing we use the first 1.90.4 run at the very same commit. We retain the second control separately for comparisons of successful distributed build steps. Windows job
The successful full workflows took 32m46s on 1.90.4 and 44m14s on 1.90.5. These runs used identical rehearsal inputs and started 27m03s apart. In the simultaneously dispatched second round, all six distributed pipeline steps passed on both versions. Their longest steps took 17m11s and 29m15s. The 1.90.4 coordinator registered all five workers in 1.7 seconds. The 1.90.5 coordinator hit its 10-minute registration timeout with only four workers and then started distributing work. The macOS runner started about 10m48s after the other candidate runners. Registration wait explains most of the 12m04s difference in those longest steps. The separate Windows probe passed when retried; retry elapsed time is excluded. Paired control coordinator · Trial coordinator · Probe retry
The ordinary PR workflow also passed in 31m18s on 1.90.5, compared with 31m04s on the previous 1.90.4 PR head. Those PR runs tested different merge bases, so the 14-second difference is historical context. Previous PR run · Current PR run
Hosted runners vary. A single pair gives an observation for that workload.
thomhurst commentedon Dec 5, 2026
TUnit 1.90.6 field measurements for #7944
Six of seven repositories consumed more active runner time on 1.90.6. Relayer consumed 12.5% less, although every sampled process held its initial parallel limit. On the same runner, the median generator process took 5.6% longer on 1.90.6. All fourteen full CI workflows passed. We compared 1.90.5 and 1.90.6 with adaptive parallelism enabled on both commits. Only the package pins changed. Each pair ran the same workflow and inputs on separate runners.
Active runner time sums the duration from job start to job completion across matching successful jobs with steps. Parallel jobs count separately. This excludes time spent queued for a runner. Selected step totals also exclude the runner queue and give a narrower view of test execution. ModularPipelines includes orchestration in its selected pipeline steps.
Scheduler observations
The ModularPipelines generator directly exercised #7944. All 6,150 tests passed in both production CI jobs. Its test step took 3m48s on 1.90.5 and 4m29s on 1.90.6. The old controller reported four CPU reductions and one rollback. The new controller reported six reductions and five rollbacks, four because fewer tests completed per second and one because queued throughput could no longer be measured. It spent 2m23s at seven slots. This confirms the new one-slot behavior and distinct rollback diagnostics in production. Control job · Trial job
Same-runner generator comparison. We built both SHAs once on one Ubuntu runner with identical coverage settings, then ran six fresh test processes. In execution order, the timings were 186.608s (old), 196.321s (new), 198.801s (new), 188.274s (old), 208.812s (old), and 213.915s (new). All six passed all 6,150 tests. The median rose from 188.274s to 198.801s (+5.6%). The new version took longer in each adjacent pair, including the reversed middle pair. It reported five CPU reductions in each process and eight throughput-loss rollbacks in total. The old version reported 3, 3 and 4 CPU reductions and one rollback of a CPU reduction across the three processes. On this workload the new diagnostic is clearer, but the repeated reductions persisted and test execution slowed. The sample covers one runner and one workload. Six-process comparison
All six distributed runner jobs in each ModularPipelines run started within one second of one another. Once running, the coordinator waited 23.9s on 1.90.5 and 40.9s on 1.90.6 for worker processes to register. Both intervals occurred after all six runners had started. The test-process measurements above exclude this coordination time. Control coordinator · Trial coordinator