New major release of Durable Functions for NodeJS

Published Jun 03 2022 01:31 PM 2,527 Views


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. 


Durable Functions (DF) makes it easy to implement robust stateful services that make full use of the scaling and billing benefits of serverlessall while using your language of choice: C#, JavaScript/TypeScript, Python, and PowerShell. 


As DF makes its way into more languages, we’ve been working on ways to optimize each programming language’s SDK to be as performant as possible. We made changes that significantly improved the performance of the Python SDK last year and 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. 


Performance Improvements


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, We then compare the performance of this benchmark between the npm package `durable-functions`  version `1.5.4` and version `2.0.0`.See results 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.  


A note 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! 


Breaking Changes: 


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`.  


You can find more details about these in our release notes.


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!


What’s next? 


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’ll focus 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. 


Keep in touch with me on Twitter via @davidjustodavid 


Other members of Durable Functions team can be found on Twitter via @cgillum, and @AzureFunctions. 


Update: Some backwards compatibility issues were detected on release. Please install DF NodeJS SDK 2.0.2 to obtain the fix.

Version history
Last update:
‎Jun 03 2022 04:42 PM
Updated by: