Search code examples
sql-serverazureazure-functionsazure-application-insightsload-testing

Azure Function App unaccounted for time in Application Insights Timeline


I am attempting to analyse the poor performance of an Azure Function when under load. This is a .NET 8 Isolated Function App (v4) running on Windows (64 bit). A small but significant number of requests lead to the behaviour shown below, where there appears to be some kind of overhead between the Http Trigger Function being called and the request being processed.

For example, the following is calling the Function App directly:

Sample end-to-end transaction from App Insights

and here is calling via another App Service:

Sample end-to-end transaction from App Insights

These are different requests, and possibly different symptoms but I suspect that the cause is the same. In both cases up to a third of the entire request duration seems to be unaccounted for. In both cases the only dependency that the Function App has is the SQL database so answers such as this do not seem relevant.

My hunch is that the area highlighted in green is potentially during some kind of scaling by the Function App, as it does not occur for the majority of requests. To prove this I would like to correlate any scaling activities with the timestamps here but can anybody advise how this may be achieved? Any other insights into the potential cause of the overhead would also be greatly received!

For reference, Azure Load Testing was used to replicate peak load.


Solution

  • I do agree and do the same way by scaling it out in Azure Functions:

    enter image description here

    In Scale Out, Set the maximum to 1.

    Because you are using Consumption Plan, there will be cold starts. To avoid Cold starts use App service plan which has Always On option. This Option keeps your function always on.