Repository navigation
[Fusion] Wake the plan executor without thread pool work item allocations - #10852
Merged
Merged
Conversation
…ions The executor's AsyncAutoResetEvent now lets an await complete synchronously when a signal is already stored. IsCompleted consumes the stored signal under the lock, so a node that completes while the executor is busy no longer forces a suspension and a thread pool round trip. OnCompleted keeps its locked re-check for a signal that arrives after IsCompleted. The event also implements ICriticalNotifyCompletion and IThreadPoolWorkItem. A wake-up queues the event itself with ThreadPool.UnsafeQueueUserWorkItem instead of allocating a QueueUserWorkItemCallback per wake, and the awaiting method restores its own ExecutionContext. OnCompleted still runs the continuation in the context captured at registration. OperationExecutionNode enqueues its merge without signaling, because the completion it reports right afterwards wakes the executor for both.
A failed wait before the gate release left the node that ignores cancellation blocked, so the fixture disposed its services while the request still held a pooled context. Each iteration now cancels, releases the gate and waits a bounded time for the request when it did not complete.
Contributor
Patch coverage94.7% of changed lines covered (54/57)
Uncovered changed lines (JSON){
"sha": "c13edb20a95a2d374c5a1789bed5a4cd5efaafa3",
"files": [
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/AsyncAutoResetEvent.cs", "ranges": [[48, 48], [118, 119]] }
]
}Project coverage: 59.5% (322296/541522 lines) |
This was referenced Nov 12, 2026
This was referenced Nov 17, 2026
chore(deps): Bump HotChocolate.Subscriptions.InMemory from 16.7.5 to 16.7.7
Kuestenlogik/Bowire#1032
Merged
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Whenever a plan node finished, the executor was woken through a newly allocated thread pool work item, and it always yielded to the thread pool even when a node had already finished while it was busy. The wake-up signal now completes right away when it is already set, and it queues itself as a reusable work item instead of allocating one.
Measured on the federation benchmark twin machine against upstream main 4adcdf2 (16.8.0-p.7) with alias batching and the deep-recursion query, 50 VUs, median of 3 interleaved 60 s rounds per mode (constant-latency adds a 4 ms subgraph delay); the harness runs the same query in process against canned subgraph responses. The k6 runs use default Kestrel and socket settings, not the inline settings the official benchmark now uses. Under 50-VU load the thread pool is busy, so the saved hop barely shows in k6, while the sequential harness shows it directly. Peak AOT memory in constant-latency was higher in 2 of 3 rounds (134 MB vs at most 114 MB) while average memory stayed the same; peak memory is noisy in this setup.