Azure Functions Slow HTTP Trigger Response Issue

Asiful Nobel 196 Reputation points
2021-04-08T12:09:25.92+00:00

I have an Azure Functions app running on dedicated app service plan. It is a .NET Core 3 app running on v3 functions runtime. I have already checked the Always On setting in function app configuration and it is set to ON. But still I am facing issue with slow HTTP call response.

It does not matter if the HTTP call has an Azure SQL database call, any other external service call or not. An API call takes 7-30 seconds to return a response. But subsequent API calls return quick response, even for different users. The slow response usually happens after 1 or 2 minutes of inactivity.

I have checked the Cold Start related docs, but did not find anything that can be a issue on dedicated app service plan.

Can someone suggest anything to solve this slow response issue?

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

1 answer

Sort by: Most helpful
  1. sadomovalex 3,636 Reputation points
    2021-04-08T15:14:27.403+00:00

    we use AF on service plan and don't have such issue. Did you try to check whether slowness caused by Azure runtime or logic inside AF itself? E.g. if to add trace log as the first line in AF:

    public static class MyFunction
    {
        [FunctionName("MyFunction")]
        public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)]HttpRequestMessage req, TraceWriter log)
        {
            log.Info("Start MyFunction");
            ...
        }
    }
    

    then open AF log (Function app > Functions > MyFunction > Code + Test > Log) and invoke your function - will this trace appear with delay or fast?
    Another thing I would try is to create new Function app with regular consumption plan and try to invoke function from there. Will this problem still be there?


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.