Repository navigation
[Fusion] Reuse the timeout CTS and complete cache hits synchronously in the request pipeline - #10713
Merged
Merged
Conversation
This was referenced Oct 27, 2026
Contributor
Patch coverage100.0% of changed lines covered (63/63)
Project coverage: 59.2% (318145/537321 lines) |
michaelstaib
force-pushed
the
perf/pipeline-timeout-cache
branch
from
October 27, 2026 19:22
c87443e to
792c24d
Compare
…in the request pipeline The Fusion TimeoutMiddleware allocated a timer CancellationTokenSource and a three-way linked source for every request. It now rents one pooled source per request, arms it with CancelAfter and links the request-aborted and schema shutdown tokens through UnsafeRegister. After a non-stream result it restores the original RequestAborted token, disposes the registrations and returns the source only when TryReset succeeds. A stream result keeps the source (timer stopped) until the stream is disposed, as before. A timeout is reported when the source is canceled while neither parent token is. DocumentCacheMiddleware and OperationPlanCacheMiddleware return the next delegate's task directly on a cache hit; misses, cache adds and plan coalescing keep their async path, and the plan cache is still looked up once per attempt.
The test gave every request a 100 ms execution timeout, so a fast request that was scheduled late under full test-suite load timed out as well. It now uses a 1 second timeout, which only the request that waits forever reaches.
michaelstaib
force-pushed
the
perf/pipeline-timeout-cache
branch
from
October 27, 2026 19:25
792c24d to
cd38823
Compare
This was referenced Oct 28, 2026
Closed
Closed
Merged
This was referenced Nov 16, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 32 others
AdCodicem/AdCodicem.ValueObjects#262
Closed
This was referenced Nov 23, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 43 others
AdCodicem/AdCodicem.ValueObjects#274
Closed
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.
Each request created a timer-backed cancellation token source plus a linked token source to enforce the execution timeout, and the document cache and plan cache middlewares added an async step even when the cache already had the entry. The timeout middleware now reuses pooled cancellation token sources, and both cache middlewares hand a cache hit straight to the next middleware. Timeout errors, request cancellation and deferred streams behave as before.
Measured on the federation benchmark twin machine with the benchmark's deep-recursion query (constant 50 VUs, gateway pinned to 4 logical cores), median of 4 interleaved 60 s runs against main. Throughput differences below about 2% are within run-to-run noise.