Azure Functions 3.0 to 4.0: Performance Deep Dive

With the release of Azure Functions 4.0 (running on .NET 6), the performance landscape for serverless has shifted dramatically. Upgrading from 3.0 (.NET Core 3.1) isn’t just a version bump; it is an overhaul of the worker process.

Cold Start Analysis

The “Cold Start” is the time it takes for Azure to provision your instance and load your DLLs. We measured this across 1000 invocations.

  • Functions 3.0 (Windows): 2.5s avg
  • Functions 3.0 (Linux): 1.8s avg
  • Functions 4.0 (Linux): 800ms avg

The switch to .NET 6’s JIT improvements means your app wakes up 2-3x faster. For HTTP triggers, this is perceptible to end users.

In-Process vs Isolated Process

Functions 4.0 introduces the “Isolated Process” model (`Microsoft.Azure.Functions.Worker`).

flowchart TB
    subgraph InProcess ["In-Process (Legacy)"]
        GenericHost["Azure Functions Host"]
        UserCode["Your DLL"]
        GenericHost --> UserCode
        style UserCode fill:#FFCDD2
    end
    
    subgraph Isolated ["Isolated (Modern)"]
        Host["Azure Functions Host"]
        Worker["Worker Process (.exe)"]
        MyCode["Your Code"]
        
        Host -- gRPC --> Worker
        Worker --> MyCode
        style Worker fill:#C8E6C9
    end

Isolated lets you fully control the `Program.cs` start up. You can inject your own Middleware (like Exception Handling or Auth) just like in ASP.NET Core.


Discover more from C4: Container, Code, Cloud & Context

Subscribe to get the latest posts sent to your email.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.