TLDR; we’ve just released a new major version of the Durable Functions NodeJS SDK.
To try out it out, install durable-functions v2.x from npm.
Note: This is a breaking change release, so make sure to check that your applications are not affected by any of the modified APIs. That said, we have only changed edge-case behaviors that we believe should not affect most apps.
As DF makes its way into more languages, we’ve been workingon ways to optimizeeach programming language’s SDKto be as performant as possible.We made changes that significantly improved the performance of the Python SDK last yearand are pleased to announce that the same has been done for NodeJS.
Version `2.x`,of DF SDK for NodeJS,contains a faster orchestration-replay algorithm (details in the “Performance Improvements” section), important correctness improvements for large fan-out-fan-in orchestrators, and some breaking changes that allows the SDK to drop unintended behavior. We describe these in the sections below.
As mentioned in the corresponding Python blog, the exact performance improvements you will see depend on your workload and your orchestration’s structure; but we expect most applications to have performance benefits from upgrading to this new release.
To get a sense of improvement, consider this simple fan-out-fan-in orchestration over 15k activities.
A fan-out-fan-in benchmark
Here we use Durable Functions Extension version 2.6.1 and run this benchmark on the Azure Functions Consumption plan for Windows,Wethen compare the performance of this benchmark between the npm package `durable-functions` version `1.5.4` and version `2.0.0`.Seeresults below.
This new major release reduces orchestration time by more than 50%!
Again, your improvement may vary, but we expect most workloads to experience increased runtime performance benefits from this release, especially for high-scale workloads.
Anote on correctness improvements
A nice side effect of our new replay implementation is that it also makes use of new features in the Durable Functions Extension to prevent race-conditions that cause orchestrations to get stuck in large fan-out-fan-in scenarios, especially if durable timers are involved.
In other words, by upgrading to this new major release, not only are you likely to receive a performance boost, allowing you to scale better than before, but you will also benefit from increased robustness at scale!
We took the opportunity to make a few breaking changes::
1) Returning a un-yielded Task from an orchestrator is no longer valid.
2) The ContinueAsNew API can no longer be yielded.
3) All user-facing Task types now inherit from a single identifier: `Task`.
To the best of our knowledge, this is the full extent of breaking changes. That said, as with any major version release, it’s always a good idea to test that your application continues working after upgrading to the new version. If you find an undocumented breaking change, please report it to our repo’s issue board here!
The DF Team continues to invest heavily in our multi-language experience. We’ll be improving the performance of the PowerShell SDK next. We are close to finishing implementing performance improvements across all DF SDKs, which is very exciting for us!.
After that, we’llfocus on bringing more feature-parity across PLs. Our team is getting things ready to tackle this, so please keep an eye out for more news from us in the future!
Keep in touch!
This is a big change so if you encounter any issues, please report them to our GitHub repository here.