Repository navigation
Avoid redundant continuations for completed gRPC client responses - #840
Merged
Bernd Verst (berndverst) merged 1 commit intoNov 12, 2026
Merged
Conversation
Record completed unary successes directly instead of allocating a continuation task and optional cancellation-state box. Preserve existing observation and channel-recreation behavior for pending and failed responses. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the optimization that avoids continuation allocations on already-successful gRPC responses.
No open issues 🎉
What changed in this PR
Optimizes gRPC client outcome tracking by skipping continuation allocation for responses that have already succeeded. This builds on the earlier channel-recovery and allocation improvements while preserving transport-failure handling.
Changes:
- Record completed successes directly, resetting the failure count without allocating a continuation.
- Add allocation regression tests and behavior coverage for completed success, pending success, and pending transport failure.
- Document the optimization in the Unreleased changelog.
| File | Description |
|---|---|
test/Client/Grpc.Tests/GrpcDurableTaskClientChannelRecreationTests.cs |
Adds allocation and channel-recovery regression coverage. |
src/Client/Grpc/ChannelRecreatingCallInvoker.cs |
Adds a fast path for already-successful unary responses. |
CHANGELOG.md |
Records the optimization under Unreleased. |
Review effort: Balanced
sophiatev
approved these changes
Nov 12, 2026
Bernd Verst (berndverst)
deleted the
berndverst-activity-execution-performance
branch
November 12, 2026 22:29
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.
Summary
What changed?
ChannelRecreatingCallInvoker.ObserveOutcome, avoiding a continuation task and optional boxed cancellation state.CHANGELOG.md.Why is this change needed?
mainatae1464cbstill unconditionally callsContinueWith, even when the response has already succeeded.Issues / work items
Project checklist
release_notes.md(this repository usesCHANGELOG.md; the entry is there).AI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
src/Client/Grpc/ChannelRecreatingCallInvoker.cs,test/Client/Grpc.Tests/GrpcDurableTaskClientChannelRecreationTests.cs, andCHANGELOG.md.AI verification (required if AI was used):
Testing
Automated tests
Manual validation (only if runtime/behavior changed)
Client.Grpcobserver, with no service/network dependency.origin/mainatae1464cb; confirm Reduce per-call allocations in ChannelRecreatingCallInvoker outcome tracking #782 leaves unconditional continuation allocation in place.ObserveOutcomebefore measurement; pre-create completed responses and cancellation sources, warm up, and measure elapsed time and thread allocations withDOTNET_TieredCompilation=0. Measure completed and pending responses, with and without cancellable tokens.Notes for reviewers
RanToCompletion, so the fast path is safe during concurrent completion. A response finishing after the check follows the unchangedContinueWithpath.