Extended Sessions for Isolated (Orchestrations)#1232
Merged
sophiatev merged 21 commits intoSep 17, 2025
Conversation
This was referenced Jul 14, 2025
Member
I'm pretty sure we can just remove this code and not replace the logic. The person who wrote it originally likely didn't really understand what they were doing, and this got missed (my fault) during that PR review. FYI, the |
cgillum
reviewed
Jul 17, 2025
added 11 commits
July 23, 2025 11:42
…the private packages
… first work item to ensure that the worker does not store the extended session state unnecessarily in the isolated model
…ssions-for-orchestrations-isolated
7bd7837 to
403829a
Compare
cgillum
approved these changes
Sep 11, 2025
added 2 commits
September 11, 2025 13:53
cgillum
approved these changes
Sep 15, 2025
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.
This PR introduces enabling extended sessions for orchestrations in the .NET isolated framework. The main changes involve adding a check for a result being injected from the middleware in the case of an extended session, as well as additional information to the
dispatchContextso that the middleware can correctly execute the extended session. I also made theIsCompletedmethod of theTaskOrchestrationExecutorpublic so that it can be used by the dotnet SDK to remove an extended session from its cache upon completion of the orchestration. The majority of the changes for this feature are in the dotnet SDK, which is responsible for actually executing the orchestrations for .NET isolated.Other PRs:
Open question
I found this existing TODO and agree that this section of code looks incorrect and dangerous. It basically checks if it is able to acquire the extended session lock (which means that
maxConcurrentSessionshas not yet been reached at that moment in time), and if it is able to, it setsisExtendedSessionto true and immediately releases the lock. I think the more correct logic is that we are in an extended session wheneverOnProcessWorkItemAsyncis called from within the loop of theOnProcessWorkItemSessionAsynccall. That is why I moved theworkItem.IsExtendedSession = truestatement there. If an extended session ends, then we break out of the loop, and will reload theworkItemfrom storage upon the next orchestration execution, in which caseworkItem.IsExtendedSessionwill be false by default.I removed this section of code in this PR, but the question is - does the
CorrelationTraceClient.Propagatecall need to be replaced with something else now? What is its point? To log something upon the start of every extended session?Manual testing done thus far
SessionAbortedException. The work item will then be retried again.Performance testing
Two scenarios were run in in-process with extended sessions enabled/disabled, and in isolated with extended sessions enabled/disabled. Multiple trials were run, and the time it took to complete the orchestration was recorded as well as the number of times the history was loaded in each of these settings (with
extendedSessionIdleTimeoutInSecondsset to 30 seconds). The two scenarios tested wereSessionAbortedExceptionbeing thrown (so the worker ends the extended session before the host, and as expected, throws the exception which leads to a retry of the work item, this time with a history attached). In in-process, there was just one history load. Without ES, there were about 100 history loads in each.