Previewing Azure Function App Premium Plans

Microsoft Azure cloud hero

One of the appeals of serverless computing is the appeal of placing my code into an environment that will rapidly scale in and out to meet my needs. With Azure Function consumption plans, for example, I don’t need to specify instance counts, or minimums or maximums. If there are no events or requests for my code to handle today, I’ll not be using any resources in Azure, and I’ll pay nothing. Tomorrow, if there are 100 billion events, Azure will scale up compute power to meet the demand and send me a reasonable bill for the amount of CPU and memory my code consumed.

But, serverless also has some downsides. Azure functions are notorious for having a cold start. The cold start is a delay in processing when the first event request arrives and Azure has to prepare computing power to host your application. With the consumption plan, there is also no control over the networking environment or the size of a computing instance. Behind the curtain of the serverless platform, there are real virtual machines. In Azure Functions, every VM instance is a one core virtual machine with 1.5 GB of memory.

Azure Function App premium plans started in preview this month. The premium plans try to remove the downsides of serverless computing while still giving you the benefits of rapid scale. What follows are some of the details.

Going Premium

Remember, everything you see here is still in Preview, so the interface and pricing are subject to change.

When you create a Function App you can access the premium plans by switching the hosting plan from “Consumption” to “App Service plan”.

Selecting the Hosting Model for Premium Plans

When you create the new App Service plan, you’ll use the Production Workloads tab. From this tab there are currently three premium plans named EP1, EP2, and EP3. The plans now give you flexibility with instance sizes, so memory hungry functions can run on instances with up to 14GB of RAM. Select one of these plans and you’ll have access to all the following features.

Premium plans are in the “Production Worlkloads” tab.

Premium Scaling

In a premium plan, you can go into the Scale Out settings under Platform Settings and specify the minimum number of instances to use. You’ll always pay for at least one instance, even if there is no activity. Note this makes premium plan pricing more like regular App Service plan pricing than consumption plan pricing. In other words, you’ll be paying to provision instances, not paying based on processor and memory consumption.

You can also specify the maximum burst, which is the maximum number of instances Azure will use. Having a maximum is useful for our systems if we have additional backend processing being overwhelmed when the consumption plan scales out to high levels.

Finally, it is also on the scale settings where you can specify the number of warm instances to keep running at all times. A warm instance already has your function app deployed and ready to respond. There is no cold start latency. As your function app scales out, Azure will add more warm instances as needed so your application will only scale into a pre-warmed instance.

When it comes to scaling, a premium plan uses the same strategy for scaling as consumption plans. Specifically, you don’t need to monitor memory or CPU thresholds and fiddle with auto-scale settings. Instead, Azure itself will monitor your environment and use heuristics to dynamically and rapidly scale in and out. When you use queues, for example, Azure will monitor the size of the queue to make sure your application isn’t falling behind.

Scale out with Function App Premium Plans

Runtime Premiums

Premium Azure Function plans allow you to connect your Function App to an Azure Virtual Network. A VNet gives you a private IP address space for your app and the ability to control the network traffic moving in and out of the app. With a VNet, you can also securely connect to on-premises resources like a database.

Another difference between consumption plans and premium plans is an unbounded run duration. In a consumption plan, Azure functions can only run for 10 minutes. But, in a premium plan the default duration is 30 minutes, and once the plans are out of preview mode you’ll be able to configure functions to run for an unbounded amount of time.

A Premium Summary

Premium plans try to blend the dynamic scalability of consumption plans with the predictable performance of a traditional app service plan. You’ll also receive the pricing of a traditional (albeit premium) app service plan. It’s best to use the premium plans if you want to use VNets for security, need more flexibility in the run durations, or you need to keep around warm instances to avoid the cold start latencies.You’ll pay for premium pricing, but the features can be worth it.