question

AsifulHaqueLatifNobel-4615 avatar image
0 Votes"
AsifulHaqueLatifNobel-4615 asked sadomovalex answered

First Request After a While Takes Seconds to Return

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-functionsazure-table-storage
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This call is usually made when the functions runtime starts up or if the table is not present. Your scenario sounds like a cold start problem. Could you confirm if have always on setup on your app?


0 Votes 0 ·

@AsifulHaqueLatifNobel-4615 Just following up here to see if my response helps


0 Votes 0 ·

1 Answer

sadomovalex avatar image
0 Votes"
sadomovalex answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.