0

Using Python 3.8 for an Azure functions app in which all the functions are HTTP triggers. We have HTTP 2 enabled ...

enter image description here

Below is our host.json file

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 2.0.0)"
  }
}

We are sending 30 requests at the same time from the client (Angular 9) application to the server (15 are OPTIONS requests and the other 15 are GETs) and are noticing that 20 of those are handled relatively quickly but then the rest take a noticeably longer time to process. Below are two of the requests side-by-side

enter image description here enter image description here

For the longer requests, I have verified through curl and Postman that individually they return in a much quicker period of time, which leads me to believe there is some concurrency setting on the srever I can adjust but I can't figure out where.

Edit: Here's a little more information. My anonymous function begins like the below ...

def main(req: func.HttpRequest) -> func.HttpResponse:
    """."""
    logging.info("received request")

but note the times reported in the Azure log for that function when the function responds slowly ...

2020-11-17 14:29:24.094 Executing 'Functions.download-image' (Reason='This function was programmatically called via the host APIs.', Id=xxx-xxx)
Information
2020-11-17 14:29:32.143 received request 

There is an 8 second delay between when I'm told the function was invoked and the first logging statement from the function. Below is what my "Scale Out" looks like ...

enter image description here

Dave
  • 15,639
  • 133
  • 442
  • 830

1 Answers1

0

For this problem, you can check if the scale out tab of your function app. enter image description here

You can scale out the instance manually, or you can also define custom autoscale according to your requirement.

As you mentioned the first 20 requests are handled relatively quickly, so I guess you choose P1 app service plan(as below screenshot show) because P1 plan has maximum 20 instances. If your current app service plan just has maximum 20 instances, you need to scale up your plan to a higher pricing tier. enter image description here

By the way, if you want the requests be handled quickly, you'd better enable "Always on" in your first screenshot. Otherwise your function app will idle if it it hasn't received a request for a long time.

Hury Shen
  • 14,948
  • 1
  • 9
  • 18
  • Thanks. I added some more detail to my question including a screen shot of that "scale out" setting. How many concurrent requests can an instance handle? Right now I have one instance. – Dave Nov 17 '20 at 15:11
  • Hi @Dave May I know which plan do you choose for your function app now ? – Hury Shen Nov 18 '20 at 02:23
  • @Dave Each instance can handle one request at same time. Please let me know which plan you choose for your function app and provide more details about your requirement(such as if you want all of your requests be handled quickly). I will do some test and provide you with a suggestion to choose right plan. – Hury Shen Nov 18 '20 at 07:16