-
Notifications
You must be signed in to change notification settings - Fork 320
Extended Sessions for Isolated (Orchestrations) #1232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended Sessions for Isolated (Orchestrations) #1232
Conversation
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 |
…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
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.