First Request After a While Takes Seconds to Return

Asiful Nobel 196 Reputation points
2020-07-18T14:22:29.06+00:00

I have a Function App running under Dedicated App Service plan. This app has many types of functions which interacts with Azure Table Storage, Blob Storage. Among these functions, there is a HTTP triggered function that makes a call to Azure Table Storage, receives the response, publishes an event using IAsyncCollector of EventHub and returns a response. Lately I have been observing that if no calls have been made to this function for a while, then the first request response takes a while like 10 seconds to over a minute.

During the investigation to find the cause of this issue, I have found that the Azure Table Storage is causing a lot of delays. One particular HTTP call that I found was causing the delay is Azure Table Storage's CreateIfNotExistsAsync which makes an HTTP call to create a table and returns 409 if table already exists. Is this normal? Should table creation logic be called in ASP.NET Core's Startup file?

Azure Table Storage
Azure Table Storage
An Azure service that stores structured NoSQL data in the cloud.
156 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,257 questions
{count} votes

1 answer

Sort by: Most helpful
  1. sadomovalex 3,626 Reputation points
    2020-09-25T15:26:55.883+00:00

    hi, if you are sure that performance bottleneck comes from CreateIfNotExistsAsync then yes you may try to move it to app startup or to installation script which will create table during installation. In this case you won't need to call it on each http request.
    Also try sync version (CreateIfNotExists) - we used it and in our case it didn't case noticable performance problems.

    0 comments No comments