Skip to content

Add fast-path message destination cache#10064

Merged
ReubenBond merged 4 commits into
dotnet:mainfrom
ReubenBond:split/message-destination-cache
Apr 30, 2026
Merged

Add fast-path message destination cache#10064
ReubenBond merged 4 commits into
dotnet:mainfrom
ReubenBond:split/message-destination-cache

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Apr 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a fast-path message destination cache for client/runtime message routing, caching resolved receivers on grain references/messages and reusing valid activation, connection, gateway, and hosted-client receivers.
  • Invalidates stale cached receivers and falls back to normal addressing when connections, activations, or client gateway state are no longer valid.
  • Avoids caching system target destinations so gateway/liveness changes are re-evaluated; keeps direct gateway connections normalized and updates client grain-to-silo mappings from responses.

Validation

  • git diff --check
  • conflict-marker scan
  • dotnet build src\Orleans.Core\Orleans.Core.csproj -m
  • dotnet build src\Orleans.Runtime\Orleans.Runtime.csproj -m

Dependencies / notes

  • This PR targets main, but is logically related to the message-oriented networking work and may need review/merge coordination with that PR.
  • Additional coverage should exercise cache hit/miss, invalidation on disconnect/reconnect, stale receiver invalidation, gateway/loopback routing, system target routing, and retry behavior.
Microsoft Reviewers: Open in CodeFlow

@ReubenBond

ReubenBond commented Apr 30, 2026

Copy link
Copy Markdown
Member Author

AdaptivePing perf comparison

Compared PR #10064 against upstream/main using the same AdaptivePing harness on both sides.

  • Before: 1fde9816a3
  • After: a9e77d7bf8
  • Build: Release, net10.0
  • Run: AdaptivePing_All with maxStableRounds: 3; warmup and measurement intervals remained at 5s each.
  • Machine: Windows 10.0.26200, Intel Core i9-13900K, 24 cores / 32 logical processors, .NET SDK 10.0.203
Scenario Before best After best Delta Best concurrency (before -> after)
Hosted Client 13,139,689/s 14,946,934/s +13.8% 100 -> 210
Client to Silo 665,756/s 871,160/s +30.9% 160 -> 190
Client to 2 Silos 1,716,756/s 1,820,492/s +6.0% 500 -> 570
Silo to Silo 727,909/s 1,235,012/s +69.7% 150 -> 390

ReubenBond and others added 2 commits April 30, 2026 08:29
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
System target references are tied to silo liveness and gateway routing. Avoid caching their message receivers so calls re-evaluate gateway availability after membership changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ReubenBond
ReubenBond force-pushed the split/message-destination-cache branch from b4aeaae to a557bbd Compare April 30, 2026 15:33
ReubenBond and others added 2 commits April 30, 2026 10:09
Allow cached reply delivery to target hosted clients directly by making HostedClient implement IMessageReceiver. This lets request.MessageReceiver participate in the response fast path instead of falling back through MessageCenter routing for every hosted-client response.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use three stable rounds by default for AdaptivePing so full scenario runs converge faster while preserving the existing hill-climbing behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ReubenBond
ReubenBond marked this pull request as ready for review April 30, 2026 17:44
@ReubenBond
ReubenBond enabled auto-merge April 30, 2026 17:46
@ReubenBond
ReubenBond added this pull request to the merge queue Apr 30, 2026
Merged via the queue into dotnet:main with commit 180f3d0 Apr 30, 2026
61 of 62 checks passed
@ReubenBond
ReubenBond deleted the split/message-destination-cache branch April 30, 2026 18:33
@github-actions github-actions Bot locked and limited conversation to collaborators May 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant