Saeldin
Saeldin

Reputation: 397

What causes the Azure API Management time-out between request received and backend execution

I have an Azure API Management resource (P2V2 tier) using Azure Functions running on a App Service Plan (P2V2 to avoid cold-starts). One of the services calling my API is having a 1 second limit before it cancels the call.

When I trace the errors in APIM's logs for these canceled calls, I can see that we sometime receive the request, but do not trigger the Azure Function, i.e. the "backend" of the API, until up to 300-600ms later after receiving it (see image). This sometime triggers a chain reaction causing the call to exceed 1 second in total execution time.

Normal backend execution times varies between 30-60ms but there are outliers.

What is causing this delay and can I do something about it? Can it got something to do with the number of instances (scale out) of the Function running reaching a max, and if so how can I know if I need to scale out?

enter image description here

Upvotes: 1

Views: 1318

Answers (1)

Hury Shen
Hury Shen

Reputation: 15724

For the problem of the function wasn't triggered in time, please check if you have enabled "Always on" button of your function app.

enter image description here

And for the question about scale out instances which you mentioned in your question, you can consider using azure function premium plan instead of app service plan. You can configure a certain number of "Always ready instances" to avoid cold start and configure the "Maximum Burst" instances. After that, when it requires more instances, it will scale out automatically.

enter image description here

Upvotes: 1

Related Questions