You can run Azure Functions in two different modes: Consumption plan and App Service plan. You must choose the type of hosting plan during the creation of the function app. You can’t change it afterward.
The consumption plan automatically allocates compute power when your code is running, scales out as necessary to handle load, and then scales down when code is not running. You don’t have to pay for idle VMs and don’t have to reserve capacity in advance. This is the serverless app model. The magic behind a consumption plan is all done via the scale controller. The scale controller automatically scales CPU and memory resources by adding additional function app instances. Scaling is based on the number of events that its functions are triggered on. For example, when you’re using an Azure Queue storage trigger, it scales based on the queue length and the age of the oldest queue message. Consumption plans by default use the A1 VM size. Like mentioned before, the unit of scale for a consumption plan is the function app. A function app can contain multiple functions. That means, all constituent functions share resources allocated to the function app and scale at the same time. Also note, that multiple function apps can use the same consumption plan and will scale independently. Each function app instance is limited to 1.5 GB of memory.
To summarize, the Consumption plan is the default hosting plan and offers the following benefits:
- Pay only when your functions are running.
- Scale out automatically, even during periods of high load.
Billing is based on number of executions, execution time, and memory used. Billing is aggregated across all functions within a function app.
App Service Plan
In the App Service plan, your function apps run on dedicated VMs on Basic, Standard, Premium, and Isolated SKUs. You can scale up by choosing a different App Service plan, but the function app is always running. Scaling is done manually or you can enable autoscale.
Consider an App Service plan in the following cases:
- You have existing, underutilized VMs that are already running other App Service instances.
- You expect your function apps to run continuously, or nearly continuously. In this case, an App Service Plan can be more cost-effective.
- You need more CPU or memory options than what is provided on the Consumption plan.
- You need to run longer than the maximum execution time allowed on the Consumption plan (of 10 minutes).
- You require features that are only available on an App Service plan, such as support for App Service Environment, VNET/VPN connectivity, and larger VM sizes.
- You want to run your function app on Linux, or you want to provide a custom image on which to run your functions.
In an App Service Plan, you don’t pay for the number of executions, execution time, and memory used. Instead, you pay for the cost of the VM instance that you allocate.
In January 2018 a test was performed that revealed that the consumption plan outperforms one or even multiple S1 instances on persistent load. Pricewise, the consumption plan has also lower costs per month than multi-instance S1 VM’s. In short. It’s a good advice to stick to the default Consumption Plan. Link: Azure from the Trenches