Azure / Azure/azure-functions-host
Linux Consumption Plan transient x second delays on outgoing HttpClients at single digit throughput
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
On a Linux Consumption plan, on at least dotnet 3.1, isolated net 5.0, and python sdk's I observe about 15% of HttpClient connections having an "n seconds" delay where n has been observed between 1 and 10.
Same function has no issues running on B1 App Service Plan (Linux), and Windows Consumption plan.
Tested in 2 regions. AU East, and US East.
Don't think it's related to this: https://docs.microsoft.com/en-us/azure/azure-functions/manage-connections
Although switching to HttpClientFactory / using static HttpClient improves things, the number of connections being opened to reproduce is well below the 600 active limit as stated on that page. Also cannot see the expected "Host thresholds exceeded: Connections" message that would implicate this.
- Timestamp:
Various between 2021-06-03 and 2021-06-04
FunctionApp runtime version: 3.0.15828.0
Function App Service Plan: Linux Consumption
Function App name: httptestlinuxconsumption
Invocation IDs:
- 5e9853c1-8ea8-405c-a1b4-126d5b1661f3
- 9db55e58-ad23-438f-9617-cfb6a7c3a55b
- e86ae5bd-8714-4cf7-b95a-057977abbc8e
- 0c8f3306-b6a2-4f27-af28-4880307eef17
Region: US East
#### Repro steps
Provide the steps required to reproduce the problem:
Create a new Linux Consumption Plan
Deploy function here https://gist.github.com/graemefoster/f34e96c9921b1e97ab518c0db539c9b7
Invoke the function about 30 times, sequentially, with an optional 0.5 second delay between invocations
#### Expected behavior
Consistent timings as per running the function on other function skus (request takes about 35ms to fetch page).
#### Actual behavior
About 85% of invocations run as expected. The rest take much longer to process.
#### Known workarounds
Using HttpClientFactory looks to improve the situation. But that's not always an option. Some libraries don't expose their inner HttpClient.
Changing to another SKU correct the problem.
#### Related information
Gist shared is C#. Python also known to exhibit the issue.
Here's a graph I captured showing the situation: Shows the other skus with much more stable consistent response. Linux Consumption plan spikes periodically.

Contributor guide
Assessment
This issue has not been assessed yet.