perf(scheduler): use activation-specific work signal#10116
Draft
ReubenBond wants to merge 1 commit into
Draft
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new activation-scoped auto-reset signaling primitive to wake an activation’s message loop and ensure continuations are scheduled via the activation’s WorkItemGroup (scheduler-affine), along with targeted unit test coverage.
Changes:
- Added
ActivationAutoResetEvent, a single-waiter, concurrent-signalers auto-reset event which queues continuations through a providedWorkItemGroup. - Updated
ActivationDatato use the new activation-specific work signal instead ofSingleWaiterAutoResetEvent. - Added
ActivationAutoResetEventTestscovering ordering, reuse, concurrent waiter rejection, scheduler-affine continuations, and wait/signal races.
Show a summary per file
| File | Description |
|---|---|
| test/Orleans.Core.Tests/SchedulerTests/ActivationAutoResetEventTests.cs | Adds unit tests validating the new activation-scoped auto-reset event semantics and scheduler affinity. |
| src/Orleans.Runtime/Versions/ActivationAutoResetEvent.cs | Introduces the new scheduler-affine auto-reset event backed by a custom IValueTaskSource. |
| src/Orleans.Runtime/Catalog/ActivationData.cs | Switches the activation message loop wake-up signal to ActivationAutoResetEvent tied to the activation WorkItemGroup. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 1
Comment on lines
+131
to
+153
| public void OnCompleted(Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags) | ||
| { | ||
| ArgumentNullException.ThrowIfNull(continuation); | ||
| ValidateToken(token); | ||
|
|
||
| object? storedContinuation = _continuation; | ||
| if (storedContinuation is null) | ||
| { | ||
| _continuationState = state; | ||
| storedContinuation = Interlocked.CompareExchange(ref _continuation, continuation, null); | ||
| if (storedContinuation is null) | ||
| { | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| if (!ReferenceEquals(storedContinuation, Sentinel)) | ||
| { | ||
| ThrowInvalidOperationException(); | ||
| } | ||
|
|
||
| QueueContinuation(continuation, state); | ||
| } |
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
WorkItemGroupwithout taking the broad scheduler refactor.Validation
dotnet build src\Orleans.Runtime\Orleans.Runtime.csproj --no-restore --nologo --verbosity minimal -property:UseSharedCompilation=falsedotnet test test\Orleans.Core.Tests\Orleans.Core.Tests.csproj --no-restore --nologo --verbosity minimal --filter FullyQualifiedName~ActivationAutoResetEventTests -property:UseSharedCompilation=falseMicrosoft Reviewers: Open in CodeFlow