How Much Memory Available For Azure Functions

How Much Memory Available For Azure Functions

In this Azure tutorial, we will discuss How Much Memory Available For Azure Functions. Along with this, we will also discuss a few other topics like Azure Function Pricing, Azure Functions Premium VS App Service Plan, Benefits Of Azure Functions Premium Plan, How To Create A Premium Plan, When To Choose App Service Plan. We will also discuss the Azure Function Consumption Plan vs Premium, Benefits Of Azure Function Consumption Plan, Azure Function Timeout, How To Configure The Azure Function Timeout In Host.JSON file? and Edit host.json File In Azure Portal.

How Much Memory Available For Azure Functions? As per Microsoft, Azure Functions can only use 1.5GB RAM and One CPU per instance for consumption Plan.

How Much Memory Available For Azure Functions

Well, here we will discuss How Much Memory Available For Azure Functions. As we already know that Microsoft provides different plans like the Consumption plan, Premium plan, Dedicated plan, etc for the Azure Functions. So the memory availability in the case of the Azure Function is based on the Azure Function plan you have.

Consumption Plan

  • As per the Consumption Plan, you need to pay them only for the time your functions run. For the billing in the case of consumption plan, Microsoft considers three main factors that are a number of executions, Execution duration for the Azure Function, and the memory used for your Azure Function.
  • Coming back to the Memory limit, As per the Consumption Plan, the memory available for one instance of the Azure Function is limited to 1.5 GB and can use only one CPU per instance.

Premium Plan

  • The next is the Premium Plan, For the billing in the case of Premium Plan, Microsoft considers mainly a few factors like the number of core seconds, The memory used per the Azure Function instance.
  • Same way, If we will see the Memory Limit in the case of the Azure Functions that are under the Premium Plan is within 3.5 GB to 14 GB max.

Dedicated Plan

  • The other Plan is the Dedicated Plan that is the same for the Function Apps in an App Service Plan for the other app service resources like Web apps.
  • The Memory Limit for the Function Apps under the dedicated plan is with in 1.75 GB to 14 GB.

ASE Plan

  • For the ASE plan, there is a flat monthly rate. The memory limit available for the Azure Function Apps is 3.5 GB to 14 GB.

So these are some key consideration on How Much Memory Available For Azure Functions.

Azure Function Pricing

The Azure Function Pricing model is mainly based on the three plans provided by Microsoft that are Consumption Plan, Premium Plan, and App Service Plan.

You can check out the details on the Azure Function Pricing now.

Azure Functions Premium VS App Service Plan

Here, we will discuss few key points between the azure functions premium vs app service plan.

Azure Functions Premium Plan

The Azure Functions Premium Plan is also known as the Elastic Premium Plan is an excellent plan for the Azure Function App that provides many cool features like No cold start, VNet connectivity, You can able to deploy the multiple Azure Function App under the same Premium Plan. The plan also allows you to configure the plan size based on your requirement.

When To Choose The Azure Functions Premium Plan?

You should choose the Azure Functions Premium Plan in the case of few Key scenarios like below

  • Choose the Azure Functions Premium Plan in case Your Azure Function Apps runs continuously.
  • If you need more memory or more number of CPUs compare to the Consumption plan as part of your requirement.
  • If your Azure Function code is taking more execution time.
  • In case, you want to utilize many premium features like Virtual network connectivity, Unlimited Code execution duration, More instance Size, Warm instances to avoid any cold start, Can able to run multiple Azure Function Apps under the same plan, etc.

Benefits Of Azure Functions Premium Plan

Scaling for the Function App is very much faster in the case of the Premium Plan. Scaling will be done once every 30 seconds. When there is a high load, the Azure function infrastructure scales CPU and memory resources by adding additional instances.

For the Function Apps that are hosted in the Premium plan, You can use either a CNAME or an A record to map a custom domain. Whereas in the case of the Consumption plan, only the CNAME option is supported.

There are many networking features that are available in the case of Premium Plan, which is like Hybrid connections that you can use to connect the Azure Function with your On-Premise Database, Virtual network Integration, Inbound and Outbound IP restrictions, Virtual network triggers, etc.

Another thing is. in the case of the Premium Plan, Your App will be always ready with a maximum of 20 number of instances. These instances help us to execute first in the case of any events begin.

How To Create A Premium Plan

Follow the below steps to Create a premium plan Azure Function App using the Azure Portal.

Login to the Azure Portal (https://portal.azure.com/)

Search for the Function App and click on the search result.

How To Create A Premium Plan Azure Function

Click on the + Add button on the Azure Function App page to add a Premium Plan Azure Function App.

On the Basics tab, Choose Your Subscription, Select the Existing Resource Group or if you don’t have any existing resource group, you can create a new resource group by clicking on the Create new link, Provide a name for the Azure Function App, Choose the Publish option as Code, Choose the Runtime stack as .NET Core, Version as 3.1 and then choose your Azure Function Region.

Finally click on the Next : Hosting > button to navigate to the Hosting tab.

How To Create A Premium Plan

On the Hosting tab, select your Existing storage account or If you don’t have any storage account click on the Create new link to create a new storage account, Select the Operating System as Windows.

The next is to Make sure to choose the Plan Type as Premium which is very important and then choose an existing Windows plan based on your region selected before or if you don’t have, you can click on the Create new link to create a new Windows plan based on the region.

Finally, click on the Review + create button.

Benefits Of Azure Functions Premium Plan

Now it will validate all the options entered by you, If you want to modify any option, you can click on the < Previous button and change any existing option value else click on the Create button to create the Premium Plan Azure Function.

Benefits Of Premium Plan

Now it will deploy the Premium Plan Azure Function App successfully. Click on the Go to resource button to see the Azure Premium Plan Function App that you have created just now.

Benefits Of Premium Plan in Azure Functions

App Service Plan

Azure Function App Service plan defines a set of computing resources for the Azure Function App or other web apps to run. Multiple Azure Function App also can run on the same App Service plan.

While creating the App service plan, we use to choose the region, internally a set of computing resources is created for that plan in that particular region.

Each of the App Service Plan defines the region, a number of Virtual machine instances, the size of the VM that could be Small, Medium, Large, and the pricing tier which could be Basic, shared, free, premium, etc.

When To Choose App Service Plan?

Choose the App service plan in case of few key scenarios like below

  1. In case you have any existing Virtual machines that are running other App Service instances.
  2. You can also choose the App Service Plan in case you want to provide any custom image on which you want to run your Azure Functions.

Pricing Tier Of An App Service Plan

The pricing tier of an App Service Plan is purely based on the App service features you are getting and the price you are paying for the same.

Below are few pricing tier of the App service plan

  • Free and Shared Compute: As per these tiers, You need to run an Azure Function App on the same virtual machine where the other App Service Apps are running.
  • Dedicated Compute: In the case of standard, Basic, and Premium tiers, the app runs on the dedicated Azure virtual machines. Only if the App belongs to the same App Service Plan can share the same compute resources.
  • Isolated: In the case of the Isolated tier, the Azure VMs runs on the dedicated Azure Virtual Network.

When you have created an app in the App service, it comes under the same App Service Plan. When the app starts running, it runs on all the virtual machine instances configured under the same App Service Plan.

App Service Plan Cost

Shared tier: Microsoft charge you based on the CPU quota in this Shared tier plan.

Dedicated tier (Basic, standard, Premium): As per these plans, You are charged based on the Virtual Machine instances the apps are scaled to. In this case, each Virtual Machine instance gets charged.

Isolated tier: For this plan, you are charged based on the number of isolated workers that run your apps. Here, Each worker gets charged.

How To Create App Service Plan?

To create the App Service Plan, you need to follow the same steps as we have created the Premium plan. So fill out all the options under the Basic Tab then click on the Next: Hosting button to navigate the Hosting tab.

On the Hosting tab, Fill out the below details

Select the Storage Account, If you don’t have an existing account then click on the Create new link to create a storage account. Then select the Operating System as the Windows.

Make sure to choose the plan type as App Service Plan. Choose the Windows Plan based on the Region, If you don’t have an existing plan based on the Region then click on the Create new link to create the new one.

Then, click on the Review + Create button as highlighted below.

How To Create App Service Plan

Now on the next screen, it will validate the details provided by you, you can cross check once and then click on the Create button to create the App Service plan Azure Function.

How To Create App Service Plan Azure Function

The deployment is completed now. Click on the Go to Resource button to see the Azure Function App you have created just now.

create App Service Plan Azure Function

Azure Function Consumption Plan vs Premium

Above, we have already discussed the Azure Function Premium plan, Now the time to discuss the Azure Function Consumption Plan.

Azure Function Consumption Plan

The Consumption plan is the Default plan in the case of the Azure Function. As per the consumption plan, it automatically handles the load while your Azure Function code is running by adding the necessary computing power and scales out the resources based on the situation, and when the code is not running it scales down the resources.

If your Virtual machines are in the Ideal state, you no need to pay anything for the same as per the Azure Function Consumption Plan.

The scale controller plays an important role in the case of a consumption plan that automatically scales the CPU and memory resources with the addition of additional Azure Function App instances based on the needs.

The Function App the unit of scale for an Azure Consumption plan. All the functions inside the Azure Function App scale at the same time.

Multiple Azure Function App can run under the same Azure Consumption plan. As per the Consumption Plan, the memory available for one instance of the Azure Function is limited to 1.5 GB and you can use only one CPU per instance.

Benefits Of Azure Function Consumption Plan

Below are few key benefits of the Azure function consumption plan

  • You need to pay only when your function is running.
  • During the time of high load, it scales out automatically.

Azure Function Timeout

Ultimately, the Azure Function Timeout is based on the Azure Function Plan or Pricing tier you are using to host your Azure Function App. Below are the details on the timeout duration based on the Azure Function plan type and the maximum extended time out duration for your Azure Function App you can configure.

  • As per the Consumption Plan, the default time out for the Azure Function is 5 minutes and you can configure up to 10 minutes maximum in the case of this plan.
  • In the case of Azure Function Premium Plan, the default time out for the Azure Function is 30 minutes and you can configure a maximum up to 60 minutes as per this plan.
  • Based on the Azure Function App Service Plan, the default timeout for your Azure Function is 30 minutes and you can configure a maximum up to No Limit as per this plan.

How To Configure The Azure Function Timeout In Host.JSON file?

If you want to configure the maximum timeout duration for your Azure Function App then You need to set the functionTimeout property value to a maximum time duration in the host.json file like below.

Note: Specify one “functionTimeout ” property based on your Azure Function Plan under which your Azure Function is running.

{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
          "samplingSettings": {
            "isEnabled": true,
            "excludedTypes": "Request",
            "functionTimeout": "00:10:00", //In case of the Consumption Plan max 10 minute
            "functionTimeout": "01:00:00", //In case of the Premium Plan max 60 minute
            "functionTimeout": "-1"        //"No Limit" in the case of the Azure Function App Service Plan
          }
        }
    }
}

Edit host.json File In Azure Portal

You can also edit the host.json file in the Azure Portal in the Azure Portal Itself by following the below steps.

Login to the Azure Portal (https://portal.azure.com/)

Navigate to the Azure Function App and click on the App Service Editor (Preview) from the left navigation on the Azure Function App page.

Edit host.json File In Azure Portal

Click on the Go –> button from the below window.

How to Access host.json File In Azure Portal

You can find the host.json file under the wwwroot directory. By default, you will not get the functionTimeout property in the host.json file.

You can add the functionTimeout property to set the maximum time out. One suggestion here is if you are configuring this property in the Development and Testing environment is fine but in the case of the Production environment, it’s not a suggestable approach.

 {
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request",
                 "functionTimeout": "00:10:00"
            }
        }
    }
}
Accessing host.json File In Azure Portal

You may also like following the below Articles

Wrapping Up

Well, In this article, we have discussed How Much Memory Available For Azure Functions, Azure Function Pricing, Azure Functions Premium VS App Service Plan, Benefits Of Azure Functions Premium Plan, How To Create A Premium Plan, When To Choose App Service Plan and We also discussed Azure Function Consumption Plan vs Premium, Benefits Of Azure Function Consumption Plan, Azure Function Timeout, How To Configure The Azure Function Timeout In Host.JSON file? and Edit host.json File In Azure Portal. Hope you have enjoyed this Article !!!

Leave a Comment