Repository navigation
Description
Description
A client where many callers share one socket and each does a few µs of its own CPU work per operation
loses 30–45% of its throughput on .NET 11 compared with .NET 10. The thread pool keeps far fewer
cores busy: on a 12-CPU cpuset, .NET 10 keeps about 11.5 busy, RC1 about 5.7 and RC2 about 7.8.
p99 latency is 4–8× worse.
This was found with StackExchange.Redis and reproduces without Redis:
https://github.com/seredis/dotnet11-threadpool-repro. That repo has a single-file Redis-free repro,
pinned SDK images, a grid runner, and raw results. Related: #135738 covers the same change
(#128606 → #132765/#132908) from the opposite direction.
Reproduction
git clone https://github.com/seredis/dotnet11-threadpool-repro && cd dotnet11-threadpool-repro
./run.py core # Docker + Python only; or by hand, see the READMEThe repro is an echo server plus a client in which:
- 64 callers share one TCP connection;
- each caller writes a request and awaits a
TaskCompletionSourcecreated with
RunContinuationsAsynchronously; - one read loop completes the callers in order;
- each caller then spins for 5 µs.
The server and the client run on disjoint CPU sets.
Results
The table is the 64-caller, 5 µs-work cell. Each figure is the median of 3 interleaved runs of 10 s,
on a Ryzen 9 7900X with the client pinned to 12 CPUs.
| ops/s | vs .NET 10 | cores busy | p99 µs | |
|---|---|---|---|---|
| .NET 10.0.12 | 1,029,128 | 11.56 | 86 | |
| 11.0.0-rc.1.26425.128 | 573,273 | −44.3% | 5.69 | 688 |
| 11.0.0-rc.2.26504.105 | 667,782 | −35.1% | 7.76 | 360 |
RC2, SpuriousDispatchNoSpinThreshold=0 |
625,107 | −39.3% | 7.21 | 475 |
RC2, SpuriousDispatchNoSpinThreshold=32767 |
695,212 | −32.4% | 8.55 | 328 |
What else the runs show:
- Runtime async is not involved. Compiling the app (and StackExchange.Redis) with
runtime-async=onor off moves throughput by about 1%. - The knob doesn't recover it. No value of
DOTNET_ThreadPool_SpuriousDispatchNoSpinThreshold
gets close to .NET 10. The same holds when 78% of operations complete synchronously (a local
cache hit), where the best value is still −30%, and with StackExchange.Redis v4's client-side
cache, where the best is −22.5%. - Neither do min threads.
SetMinThreads(32 or 128)makes RC2 about 8% slower. The pool already
has 13–16 workers; they are parked while work is queued. - It depends on how many callers there are and how much they do. With 1 or 4 callers, RC2 is within
5% of .NET 10. With 16 callers it is −16%, with 64 callers −36%, and with 256 callers −26%. At
20 µs of work per operation the loss is −17% to −19%. With no work at all, .NET 11 matches
.NET 10 throughput on far less CPU. - With 4 or 8 client CPUs, RC2 is worse than RC1: −29% and −32%, against RC1's −18% and −25%.
- The threshold favours different workloads at each end. For StackExchange.Redis v4 with
64 callers doing pure round trips, RC2's default is −14% vs .NET 10. Threshold 0 gives +5%.
The same threshold 0 costs 7 points on the client-cache cell. This is the same pull Runtime async has major perf regression since .NET 11 RC2 #135738
describes.
Analysis
RC2's #132765 recovers part of what #128606 cost in RC1. What remains doesn't respond to the
threshold at any value, so the parking decision that #132765 made tunable doesn't fully account for
it. #122726 (shorter LIFO semaphore spinning) and the rest of #128606 are the candidates I can see,
but I haven't bisected beyond RC1/RC2/the daily.
Possibly related: #93234
Configuration
- .NET 10.0.12 vs 11.0.0-rc.1.26425.128 and 11.0.0-rc.2.26504.105, from the official SDK images
pinned by digest. Each result records the exact runtime build. - Linux x64, kernel 7.1, Ryzen 9 7900X. The client is pinned to 12 CPUs.
- Server GC.
Regression?
Yes, from .NET 10.
Activity
dotnet-policy-service commentedon Oct 15, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @VSadov
See info in area-owners.md if you want to be subscribed.
hez2010 commentedon Oct 15, 2026
Actually, I'm not able to reproduce your results in my environment (i7-13700K):
Maybe it's somehow an AMD specific issue?
kfrancis commentedon Oct 15, 2026
Data point from AMD, re the "AMD-specific?" question: Ryzen 9 9950X (Zen 5, 16C/32T), but under WSL2 (Windows 11 + Docker Desktop, kernel
6.18.33.2-microsoft-standard-WSL2), not bare metal. I don't reproduce the regression here, but I don't think this setup can show it. Details below.run.py core --server-cpus 0-7 --client-cpus 16-27(client sees 12 CPUs = 6 SMT pairs; server on 4 other cores). Same pinned images, 3 × 10 s runs after a 3 s warmup, medians.64 callers, 5 µs work:
Other cells, RC1 / RC2 vs .NET 10: 1 caller −23.2% / −12.5%; 64 callers no work +3.7% / −10.5%; 64 callers 20 µs work +1.5% / +5.8%; 78% local hits +2.4% / +1.8%.
Caveat: .NET 10 only reaches ~197k ops/s with 4.3 of 12 cores busy (vs ~1.03M and 11.56 busy on the 7900X). So the client is never CPU-bound here; the bottleneck is likely WSL2 loopback/vCPU scheduling. The regression in the issue shows up as .NET 10 saturating cores and .NET 11 not, so this run can't really confirm or rule it out. Spreads are also high (up to ~60% in some cells). WSL2 vCPUs aren't pinned to physical cores, so
--cpuset-cpusonly pins inside the VM.The 1-caller cell does regress (RC1 −23%, RC2 −12.5%), in the same direction as the 7900X (−16.5% / −4.1%).
I can rerun on bare-metal Linux on this box if that would help.
Full summary.md
core
2026-10-15T11:28:27, AMD Ryzen 9 9950X 16-Core Processor, kernel 6.18.33.2-microsoft-standard-WSL2, server CPUs 0-7, client CPUs 16-27, 3 repeats of 10 s after 3 s warmup. Medians; the percentage is against the .NET 10 row (of the same library, for Redis) in the same cell. busy is CPU cores the client kept busy (process CPU time / wall time).
1 caller
64 callers
64 callers, 5 us work
64 callers, 20 us work
64 callers, 78% local hits, 1 us work
What ran
Processor count seen by the client: 12.
hez2010 commentedon Oct 15, 2026
@mgravell Since I cannot reproduce your result, maybe you can have a try on #135738 (comment) in your environment
VSadov commentedon Oct 23, 2026
I am able to repro a roughly 20% regression on the redis-free repro sample. (in WSL on an AMD VM).
VSadov commentedon Oct 28, 2026
@mgravell do the machines involved in this scenario have deep sleep enabled (aka powersave, C6 state, ...)
Having deep sleep enabled/disabled may explain why not everyone can repro this.
Deep sleep may affect how long it takes for a parked thread to wake and in a latency-sensitive scenario (i.e. client/server ping-pong like scenario) latency may gate the throughput.
Deep sleep behavior may also vary with CPU. Another reason it may or may not reproduce.
Nothing in general is wrong with deep sleep enabled. I mostly wonder what a typical case would be.
Frulfump commentedon Oct 29, 2026
Any change with RC3 since RC1 and 2 are out of support? I assume no but still.
https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core
MichalPetryka commentedon Oct 29, 2026
RC3 was a vulnerability fix only afair.
mgravell commentedon Oct 29, 2026
@VSadov investigating now; also checking windows and linux separately (I have dual boot on the same hardware)
mgravell commentedon Oct 29, 2026
@VSadov good question. I've run the Redis-free repro natively on Windows, with idle states on and off. The machine is the same as for the Linux numbers in the repro: the box dual-boots, so it's the same Ryzen 9 7900X. The Linux run with C-states toggled will follow when I next boot into Linux.
Short version: on Windows the regression doesn't reproduce, with deep idle on or off. Idle states do matter, but the runtime they hurt most is .NET 10, not .NET 11.
Setup: the same pinned runtimes as before (10.0.12, 11.0.0-rc.1.26425.128, 11.0.0-rc.2.26504.105), with the server on cores 0-3 and the client on cores 6-11 (12 CPUs). Each figure is the median of 3 interleaved runs of 10 s, and the 3 runs agree within about 1-2%. "Idle off" is
powercfgIDLEDISABLE=1.vs .NET 10 under the same idle setting
RC2 with
SpuriousDispatchNoSpinThreshold=0lands within about 1-8 points of default RC2 in every cell.64 callers, 5 µs work
For comparison, the same cell on Linux (deep idle at its default) was .NET 10 at 1,029,128 ops/s (11.56 busy) and RC2 at 667,782 (7.76 busy).
What I take from this:
Caveats:
IDLEDISABLEturns off every idle state, C1 included; the processor polls. I couldn't test "C6 off, C1 on": Hyper-V is running on this box (for WSL/Docker), andIDLESTATEMAXhas no effect under it. I set several values and the C1/C2/C3 residency counters didn't change, whereasIDLEDISABLEtakes residency in every state to 0. On Linux I'll run both:cpupower idle-set -D 0to match this run, and-D 2for C6 only.mgravell commentedon Oct 29, 2026
@VSadov here are the Linux C-state runs, completing the Windows half. Same machine (7900X, dual-boot), Pop!_OS, kernel 7.2.6, same pinned runtimes, server on cores 0-3,12-15 and client on 6-11,18-23. The cpuidle states here are POLL (0 µs exit latency), C1 (1 µs), ACPI C2 (18 µs, the deep CC6 state on Zen 4) and C3 (350 µs). Three full runs of the core grid, one per idle configuration: default (all states), C1 only (C2/C3 disabled), and POLL only (everything disabled — matching the Windows
IDLEDISABLErun). States were toggled via/sys/devices/system/cpu/cpu*/cpuidle/stateN/disable, and I verified theusagecounters of every disabled state stayed frozen across each run.Short version: idle states do not explain the Linux regression. The deficit vs .NET 10 is the same under all three configurations, including with every C-state disabled.
RC2 vs .NET 10 under the same idle configuration
RC1 behaves the same way (5 µs cell: −42.4% / −40.2% / −38.4%).
64 callers, 5 µs work
What I take from this:
IDLEDISABLEbought .NET 10 +10% in the 5 µs cell and +29% at 1 caller. Here C1-only is a wash everywhere, and POLL-only costs ~18% at 1 caller for every runtime (.NET 10 55.8k → 45.6k ops/s, RC2 52.8k → 43.7k) — polling siblings presumably eat the boost/SMT budget.Raw data, per-run idle-state records and the grid script are on the repro repo under
results/core-20261029-*.Mercurial commentedon Nov 16, 2026
Another data point, in case it helps: a .NET 10-to-11 slowdown in a single process, with no sockets and one round trip in flight. This is a different workload from the original report; we have not established a common cause. We met it while moving a network protocol library to .NET 11; its receive path passes each message through a
Pipeand a bounded channel.What we ran. Two tasks exchange one request and one reply at a time. The worker side executes 2,000 iterations of a multiply-add loop per request. The hand-off primitives are configured to schedule pending continuations asynchronously; awaits can still complete synchronously. Three variants of the same exchange: two bounded
Channel<long>of capacity 1;TaskCompletionSourcewithRunContinuationsAsynchronously; twoSystem.IO.Pipelines.Pipewith default options. No packages; the source is at the end.Setup. One net10.0 DLL, run with
dotnet --fx-versionon 10.0.15 and 11.0.0. Linux x64 (kernel 6.12), a cloud VM with 8 dedicated vCPUs (AMD EPYC, Fly.io performance-8x, 16 GB), steal 1.3%, workstation GC configured in the project, no pinning. 8 rounds; in each round every configuration runs in a fresh process (180 warm-up and 60 measured passes of 10,000 round trips), in rotated order. Figures are medians over the rounds. Ratios are taken per round against 10.0.15 and shown as median (lowest–highest). "Noise" is 10.0.15 run a second time in the same round.“Request” is elapsed time from the timestamp taken just before publishing the request to the worker's timestamp immediately after its receive await returns, before
CpuWork. For pipes this includes reading and decoding the 8-byte timestamp. Context switches are differences between sums ofvoluntary_ctxt_switchesover/proc/self/task/*/status.The pipe comparison is noisier: its slowdown range overlaps the repeated-.NET-10 range.
TaskCompletionSource, and 9.5× for pipes on 11.0.0 versus 10.0.15.TaskCompletionSourcethe median-of-rounds Request p50 is lower on 11.0.0, but p90 goes from 0.7 to 1.8 µs and from 0.4 to 1.4 µs, and p99 from 1–2 µs to about 5 µs.DOTNET_ThreadPool_SpuriousDispatchNoSpinThreshold=0makes this shape slower for channels andTaskCompletionSource: 1.33 (1.13–1.36) and 1.36 (1.25–1.48) against 10.0.15. The pipe stays at 1.16 (1.05–1.34). CPU per round trip drops to 36–54% of .NET 10's, and median voluntary context switches rise to 0.49–0.76 per round trip.DispatchQuantumMsafter the most recent worker request from outside the work-queue dispatcher. This worker-to-worker exchange may be relevant, but we have not built or measured that PR.Program.cs and HandoffRepro.csproj
Save both files in an empty directory and build with a .NET 10 SDK:
dotnet build HandoffRepro.csproj -c Release -o bin. With the requested runtime installed, run:dotnet --fx-version <version> bin/HandoffRepro.dll <channel|tcs|pipe> 2000 180 60 10000 out.json.