Is it possible to view memory usage / how many consumption units you are presently/historically using for Azure Functions?
I'm currently using the consumption plan for a function which handles messages from a service bus queue. Each message takes around 5 seconds to process and there are usually several hundred messages / second to be handled.
My fear is simply that at some point I will starting seeing outofmemoryexceptions with no forewarning, though it would also be helpful for me to get an idea of costing before being billed.
I've looked through the portal and all I've found is the success count and pulse (which never seems to report any data for my function. Though the graphs are drawn - they are always empty.)
There is also this blog post:
https://blogs.msdn.microsoft.com/appserviceteam/2016/11/15/making-azure-functions-more-serverless/
..which essentially says that you do not need to specify your memory cap anymore and providing your usage is within 1.5GB & your processing is under the 5 minute timeout then life is good. Knowing how much room I have would be reassuring though!
Function execution units are a combination of execution time and your memory usage, which makes it a difficult metric for understanding memory usage. Memory data isn't a metric currently available through Azure Monitor.
Standard Azure Functions (not Durable Functions) have a maximum timeout of 10 minutes on a consumption plan. This is the same timeout for the new Function Runtime ~4 (missing in the link).
Consumption. Azure Functions consumption plan is billed based on per-second resource consumption and executions.
The simple answer to your question is "yes".
Use the Azure Monitor Metrics REST API to get FunctionExecutionUnits and FunctionExecutionCount metrics.
This sample call:az monitor metrics list --resource /subscriptions/<subid>/resourceGroups/pbconsumptionexample/providers/Microsoft.Web/sites/pbconsumptionexample --metric FunctionExecutionUnits,FunctionExecutionCount --aggregation Total --interval PT1M
yields the following sample output shows 153600 MB-milliseconds, or .15 GB-ms:
"name": {
"additionalProperties": {},
"localizedValue": "Function Execution Units",
"value": "FunctionExecutionUnits"
},
"resourceGroup": "pbconsumptionexample",
"timeseries": [
{
"additionalProperties": {},
"data": [
{
"additionalProperties": {},
"average": null,
"count": null,
"maximum": null,
"minimum": null,
"timeStamp": "2018-04-13T23:40:00+00:00",
"total": 153600.0
}
],
"metadatavalues": []
}
],
Here's an explanation of how:
https://github.com/Azure/Azure-Functions/wiki/Consumption-Plan-Cost-Billing-FAQ#how-can-i-access-execution-count-and-gb-seconds-programmatically
For greater context:
https://github.com/Azure/Azure-Functions/wiki/Consumption-Plan-Cost-Billing-FAQ
You can use the Monitor -> Metrics
view in the Azure Portal:
For more information on this topic see this functions cost/billing FAQ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With