Reputation: 909
All the functions in our Function Apps seem to be reporting weirdly high resource consumption. From the docs:
Functions are billed based on observed resource consumption measured in gigabyte seconds (GB-s). Observed resource consumption is calculated by multiplying average memory size in gigabytes by the time in milliseconds it takes to execute the function. Memory used by a function is measured by rounding up to the nearest 128 MB
(I know it's also priced per million executions, but I'm investigating a single execution here).
The "monitor" blade for my function shows that the last execution had a duration of 47659ms, or 47.659 seconds. The "memory working set" metric says that my function was using 117MB at its peak, so round that up to 128MB, and my function's resource consumption should be:
0.128GB * 47.659s = 6.1 GB-s.
Problem is, for that execution the "Function Execution Units" metric shows that it actually used 5.94M (million) GB-s. I'm pretty sure M = Million because some tiny ones earlier on had a "k" suffix instead of an M (the function was failing to start back then and only ran for ~100ms).
I also have the daily execution quota set to 13,333 so the whole Function App should have immediately stopped for the day, but it hasn't, and one of the other functions executed a few minutes after. Attached is a screenshot with the execution in question indicated along with the other one. I've asked other people here to log in and check it out, and everyone sees the same kind of thing, on all function apps.
What am I missing here?
Edit: the metrics API shows the same weirdness - a function execution that runs for 591ms returns this:
az monitor metrics list --resource 'func-name' --resource-group 'rg-name' --resource-type 'Microsoft.Web/sites' --metrics 'FunctionExecutionUnits'
{
"average": null,
"count": null,
"maximum": null,
"minimum": null,
"timeStamp": "2020-07-06T06:55:00+00:00",
"total": 120064.0
}
Upvotes: 0
Views: 1469
Reputation: 909
Finally found some clarity on a different documentation page, Estimating Consumption plan costs, at the bottom of the "View Execution Data" section there's an example for how to generate a chart of Function Execution Units, and underneath their example chart, it briefly mentions the following:
This chart shows a total of 1.11 billion Function Execution Units consumed in a two-hour period, measured in MB-milliseconds. To convert to GB-seconds, divide by 1024000.
Would have been a lot clearer if the units were displayed in Azure Monitor and/or mentioned in the Functions Pricing docs. But my fault for not RTFM...
Upvotes: 4