Azure functions cold start and parralelism in the same function app

louey Bnecheikh lehocine 20 Reputation points
2024-11-11T11:55:43.54+00:00

Hi

I have two questions:

1- As your post about Azure functions cold start process https://azure.microsoft.com/en-us/blog/understanding-serverless-cold-start/ functions are loaded into process memory when a trigger happens. As all functions share the same process, each function in the function app is loaded into memory separately when trigerred or all the functions are loaded at the same time when one of the functions is trigerred ? can you please clarify this point ? it is important for organizing functions in separate/same app.

2- In the consumption plan, each function app has 1 CPU which mean all functions in that app share this CPU, no real parralelim is though possible only concurency can happen, the only way to do parralelism is to use a dedicated plan with > 1 cpu right ?

Thanks in advance

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,198 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 29,291 Reputation points Microsoft Employee
    2024-11-11T22:46:07.8133333+00:00

    Hey @louey Bnecheikh lehocine

    The unit of scale is the function app for the host instance. So, when a trigger is invoked, the scale controller will load the function app and cold start the triggered function. The scale controller is important because it determines how many host instances to allocate.

    Referring to Service limits, a consumption plan can receive up to 100 ACU for a consumption plan. This is the "server" mentioned in Steps 1 and 2 under What happens when I write a function on https://azure.microsoft.com/en-us/blog/understanding-serverless-cold-start/ but you are correct in that each host instance gets 1 CPU. But I can't say that parallelism can't be done. It depends on the underlying hardware and runtime you're using, which I don't know the absolute specifics for a consumption plan. What I can say and suggest though, is that if you're trigger function is lacking the necessary CPU performance to quickly execute, then scale up to a higher plan. Before doing that, make certain you leverage detectors like Functions Scale Overview to better understand how your app is scaling and where you can make optimizations.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.