Azure Function - take it to the limit, scale it up


Azure Functions are really cool #AzureFunction.  I wrote numerous articles about Azure Functions here, check them out.  As you know there are 2 kinds of Azure Functions:

  • Consumption – do not have to worry about resource management
  • App Service Plan – run your functions just like other Azure App Services

Each have a different set of rules and features which you can read about here.  I write this article specifically from the App Service Plan (ASP) perspective based on an experience I had working a performance issue, see Figure 1.  When you select to run your Azure Function on an ASP you get to choose the size of the instance it runs on.  By size I mean something like 1xCPU/1.5GB, 2xCPU/3.5GB or 4xCPU/7GB.  This is in contract to an Azure Function running via the consumption plan where you do not need to manage that.

image

Figure 1, creating an Azure Function on an App Service Plan

The experience I had was that the Azure Function was throwing some unexpected errors and timing out.  After some analysis I realized that I was running a pretty resource intensive Function on a 1xCPU virtual machine (VM).  Looking at the CPU consumption I saw it was hitting 100%.

NOTE:  It is possible to run App Services and Azure Functions on the same ASP.  All of those App Services, Azure Functions and the OS will compete for the same resources allocated to the ASP.

To resolve the issue, I scaled my ASP to an S3 and the unexpected behaviors and exception stopped happening because there was enough CPU and memory for my function to process and complete.

To scale your Azure Function up or down, access the Azure Function and click on the Platform features link, as shown in Figure 2.  Then click on App Service Plan.

image

Figure 2, scaling an Azure Function hosted on an App Service Plan

When the ASP blade opens, select the Scale up link and then scale to the size in which your function requires to run in.  See Figure 3.

image

Figure 3, scaling an Azure Function hosted on an App Service Plan

Save the change and good things will happen.

Comments (1)

  1. Chris Surfleet says:

    Hi Ben

    Why do you not use the consumption plan for this stuff? I've never seen a good argument for ASP when hosted in azure itself

Skip to main content