Comparing .NET In-Process and Isolated Azure Functions
Azure Functions became very popular and attractive in the market, as Serverless solutions, with the promise to allow for flexibility and reduction of costs, as you would leverage and pay for computing runtime, without the worries of managing scaling.
The service evolved from v1 to v4 (as of today) over the years, and with that, the hosting options evolved as well, from the only In-process hosting to now the additional Isolated (Out-of-process) hosting.
In this post, I would like to bring to your attention where we are and what the future is.
In-process Functions
This is how Functions were originally conceived with .NET, and they are still a great choice due to its performance benefits, to mention ReadyToRun
(a form of ahead-of-time compilation) and better .NET Cold start times
. If you have tried a PowerShell Function before, you probably know the pain of how long it takes to execute your code, this is because it is not in-process.
With the In-process mode, the runtime loads the Function implementation within the same .NET process.
If you are trying to use Durable Functions
, stateful functions in a serverless compute environment, at the moment In-process is the only way.
Binding types are very useful when you need listeners to trigger calls from/to different services. In specific with Output Binding types
, you have better support.
Out-of-Process Functions
The Out-of-process mode allows you to have flexibility on how you deal with the .NET version, as it runs in its own bubble, allowing you to try different versions.
A custom middleware
was never possible with In-process mode. This is a great flexibility obtained with Isolated functions.
When .NET 7 is out, in the second half of 2022, then Durable Functions
will be available. Please see the Roadmap below.
What's the direction?
This is the future of the .NET Functions:
Roadmap article announced here
UPDATED SEP 12, 2022 .NET on Azure Functions Roadmap Update
UPDATED AUG 29, 2023 .NET on Azure Functions Roadmap Update
In-process Functions are still game on, but the new kid on the block is the future. For a full comparison between the Function modes, please check this link.
Looking at the comparison, it seems clear to me that if you don't have the need of running Durable Functions, nor have specific Output binding types, use Isolated Functions. Otherwise, stick to the In-process mode until further updates from Azure this year.