none
Azure Functions Memory Size Setting RRS feed

  • Question

  • Hi:

    I am building a function app using Azure now, but I may need to set a maximum memory size in this function.

    But it seems currently the the memory size is auto scaled to 1.5 GB.

    To solve this, I found a way to set the container size to 128MB using:

    # GET

    Get-AzureRmResource -ResourceGroupName {resourceGroup} -ResourceType Microsoft.Web/sites -ResourceName {functionAppName} -ApiVersion 2015-08-01

     

    # SET

    $PropertiesObject = @{

                containerSize = "128";

    }

    Set-AzureRmResource -PropertyObject $PropertiesObject -ResourceGroupName {resourceGroup} -ResourceType Microsoft.Web/sites -ResourceName {functionAppName} -ApiVersion 2015-08-01 -Force

    After I set this number, I found there are two places changed,

    one is the "ContainerSize" on the Azure Resource Explorer page under "sites" label changed to 128.

    the other is the "WEBSITE_MEMORY_LIMIT_MB" value is 128 which is under Kudu's "environment variable" region.

    Now my question is what does these parameters exactly means?

    Is this means I will get an "Out of memory exception" if I am trying to access more than 128MB memory?

    Is there any official documents explaining this?



    • Edited by AngelZhang Saturday, June 24, 2017 10:12 PM
    Friday, June 23, 2017 9:14 PM

Answers

  • The container size setting is a hold-over from an early preview of Azure Functions where you had to set the memory limit of your function and that setting was what determined how you were billed. If you'd like some more context on the change that happened see this post. The fact that its still present in our REST API is just an API cleanup issue. The important thing to note is that this setting is not honored any more. Instead you are billed for your actual memory usage. The closest thing we have to an enforced limit is that you can specify a max daily GBsec. This feature is in the settings tab.
    • Marked as answer by AngelZhang Monday, July 3, 2017 9:08 PM
    Monday, June 26, 2017 9:03 PM