Premium Hosting Option for Azure Functions
Up till recently, Azure Functions had 2 main hosting/pricing plans. One being the Consumption Plan where you are billed for executions based on per execution and memory used that aligns with a Pay-As-You-Go pricing model. The other one being a Dedicated App Service Plan where you host your Azure Function on an App Service Plan just like a Web App or an API App. This has its own benefits like predictive billing and unlimited execution time for your function apps.
Recently Microsoft has introduced another pricing model for Azure Functions and this one is an interesting offering. It’s called Premium Plans for Azure Functions and it has characteristics from both Consumption and App Service plans. This Premium plan is still in preview at the time of writing this article. Let’s dive in a little deeper.
How Is Premium Plan Different?
Instead of billing per execution together with the memory used like in Consumption Plans, Premium plans are billed by a combination of Number of Core Seconds, Execution Time and the Memory used across all the instances that function are running on. But unlike the Consumption Plan where you are not billed when your function is not running, Premium Plan must always have at least one instance running with additional Pre-Warmed instances that you can add if you choose. That means you are incurring the Core Seconds for the active instances, even without the execution time and memory. This gives a fixed monthly cost for any active plan, similar to App Service Plans.
Apart from these changes, there are some additional features that Premium Plans provide.
- Support for having Pre-Warmed Instances for Your Function Application. In Consumption Plans, once the function app stops receiving events the app is scaled down to zero instances. And when events come, a new instance needs to be started up with your application in it. This takes some time. This is called a Cold Startup. If you need to eliminate cold startup times that come with the Consumption Plan you can use Premium Plans. You need to have at least one Pre-Warmed instance running at all times with the option to have multiple Pre-Warmed instances running waiting for events to come.
- VNet Support if you want your Function apps to communicate with resources inside of a private network. You can also restrict income traffic via IP restrictions.
- Unlimited execution time is available for your Functions. Compared with the Consumption plan where you are limited to 5 minutes by default and up to 10 minutes by modifying the host.json file, Premium plans do not have any execution limitation. However, it’s limited by default to 30 minutes to deal with any runaway executions, but you can easily extend this limit to be unlimited using the host.json file.
- Apart from any existing Pre-Warmed instances you may have in the Premium plan if that compute capacity is overwhelmed by incoming events, Premium plans automatically adds new instance as quickly as possible just like a Consultation Plan.
- Premium plans have 3 different instance SKUs to select from with an increasing number of vCPUs (1, 2 and 4) an increasing amount of memory that you can select according to your workload.
- Having at least one instance running and with may be multiple Pre-Warmed instances gives you predictable cost estimations for your monthly bill.
With this added feature in mind, we need to think about when we need to use Premium plans for Azure Functions.
When to Use Premium Plans for Azure Functions?
There are several scenarios where you could use Premium Plans to overcome certain limitations that other hosting options like Consumption Plan have.
- If your functions need to run for more than the 10-minute execution limit or run near continuously then the Premium plan is a good option compared with App Service plans.
- If you need more compute and memory capacity for your functions than what is provided by the Consumption plan Premium plans are a good option.
- If the functions need to access resources that are in a private VNet then you can use Premium plans to host your Azure Function app inside of a VNet.
Premium Plans for Azure Functions fills a gap that existed on Function Hosting Options where we didn’t really have an option that has the best of both worlds when it comes to Consumption and Dedicated App Service plans. Premium plans have features that come from both Consumption and Dedicated plans and remove some of the limitations that other hosting options have when it comes to execution duration and compute and memory resources among other things.
You Might Also Like
← Previous Post
Next Post →
September 06, 2019