Manual Scaling of Azure Functions

Learn how to apply static scaling and concurrency in Azure Functions.

If we expect our web application to handle an increased volume of incoming connections and requests, we need to scale it. There are two types of scaling, which are outlined below:

  • Vertical scaling, also known as scaling up and scaling down. We scale our application up by allocating more computational hardware to its host system. We scale the application down by downgrading the hardware to save costs.

  • Horizontal scaling, also known as scaling out and scaling in. We scale an application out when we make more replicas of it so the incoming load can be distributed between them. We scale in the application by reducing the number of replicas when the volume of incoming requests becomes lower, so we can be charged less.

Azure Functions allows us to do both types of scaling via Azure Portal.

Scale vs. concurrency

Concurrency is related to scale, but it’s a different concept. Scale refers to how many instances of the application are running at the same time or how much hardware is allocated to run the application. Concurrency is a setting that controls how many operations can run at the same time within a single instance of an application.

The higher the concurrency—the more simultaneous operations the application can perform. However, when concurrency is too high, the application might add pressure on other resources, such as the database it’s connected to.

In Azure Functions, scale is configured in Azure Portal. Concurrency, on the other hand, is configured in the host.json file.

Scaling a function

To scale our function either horizontally or vertically, we open the function app in Azure Portal. In the “Settings” section of the menu on the left, we select either the “Scale up (App Service plan)” or “Scale out (App service plan)” options, as the following screenshot demonstrates:

Get hands-on with 1400+ tech skills courses.