What is the difference between the In-process model and the isolated worker model
Model | Description |
---|---|
Isolated worker model | The Code you are running is running independant of the Host environment of the Function (Explanation and advantages are listed below) |
In-process model | With this model, the function and the host are running on the same process |
Understand the difference
The In-process is being decomissioned by Microsoft by end of 2026! Therefore you should use the Isolated worker model in any way, but still I find it interesting to understand the difference between the two models Microsoft is offering or has offered, depending when you are reading this.
In-Process model
This model runs the function code inside the same runtime as the host of the function. There are some problems or sources of problems which might occur in this case.
- Shared memory:
- Both environments share the same memory
- Communication between both parties are shorter, as they don't need to cross process
- Dependency Coupling
- The code must be compatible with the host's environment and dependencies
- So if the host uses dotnet 6 and the code is using dotnet 8, it won't work. Both need the same dotnet sdk
- Performance:
- As already mentioned in point number 1, the in-process model is faster due to the fact that there is no need for seperate processes. This is also visible in the performance of the application. It might be only a small difference, but there might be offering
- Stability Risk:
- If the function crashes, the whole environment will crash
Isolated Worker model
This model is the exact opposite of the in-process model. Here the host and the function communicate via inter-process communication. In this case there are 2 main points to check:
- Isolation: When the function crashs, the host will not fail
- Flexibility: Different .NET versions can be used
That isolation and flexibility is highly important becuase one host can run multiple functions.