Site icon Rajeev Singh | Coder, Blogger, YouTuber

Azure Function: Deployment Options -Consumption, Premium, Dedicated (App Service-Plan)

Overview:

When you create a function app in Azure, you must choose a hosting plan for your app. There are three basic Azure Functions hosting plans provided by Azure Functions: 

Consumption plan

Premium plan, and 

Dedicated (App Service) plan.

These hosting plans are facilitated by Azure App Service infrastructure and are generally available (GA) on both Linux and Windows virtual machines.

How do you choose Azure Function deployment options?

The Azure Functions hosting plan you choose dictates the following behaviors:

In addition to Azure Functions hosting, you can also host containerized function apps in containers that can be deployed to Kubernetes clusters or to Azure Container Apps. If you choose to host your functions in a Kubernetes cluster, consider using an Azure Arc-enabled Kubernetes cluster

Overview of plans

The following is a summary of the three main Azure Functions hosting plans:

Deployment optionBrief descriptionWhen to useBenefitsLimitations
Consumption planThe serverless hosting option for Azure Functions.     You only pay for the time your functions run.     Azure scales the resources needed to run your functions automatically.When you have event-driven, stateless, or short-lived functions that do not require a fixed number of VMs or instances.– Low cost and high scalability.   No need to manage infrastructure or servers.   Supports a variety of triggers and bindings.– Cold start latency for the first execution or after idle periods.   Limited execution duration (up to 10 minutes).   No support for VNet integration or custom domains.
Premium planA hosting option that provides the same features as the Consumption plan, but with enhanced performance and additional capabilities.   You can pre-warm instances to avoid cold start, and you can run functions for longer durations.   You also have more control over scaling and networking.When you need more consistent performance, longer execution times, or more advanced features for your functions.– All the benefits of the Consumption plan, plus:   – No cold start latency with pre-warmed instances.   – Longer execution duration (up to 60 minutes).   – Support for VNet integration and custom domains.   – Ability to configure minimum and maximum scale.– Higher cost than the Consumption plan.     – Requires more configuration and management.
Dedicated (App Service) planA hosting option that runs your functions on dedicated VMs or instances, similar to how App Service web apps are hosted.     You have full control over the scaling, networking, and configuration of your functions.When you have functions that require a fixed number of VMs or instances, or when you want to share the same App Service plan with other App Service apps or functions.– Full control and flexibility over the hosting environment.   – Support for VNet integration and custom domains.   – Ability to run functions on Linux or Windows.    – Ability to run functions in an isolated environment.– Highest cost among the three options.     – No automatic scaling based on demand.   – Requires more configuration and management.

Benefits:

PlanBenefits
Consumption planScale automatically and only pay for compute resources when your functions are running.   On the Consumption plan, instances of the Functions host are dynamically added and removed based on the number of incoming events.   ✔ Default hosting plan. ✔ Pay only when your functions are running. ✔ Scales automatically, even during periods of high load.
Premium planAutomatically scales based on demand using pre-warmed workers, which run applications with no delay after being idle, runs on more powerful instances, and connects to virtual networks.   Consider the Azure Functions Premium plan in the following situations:   ✔ Your function apps run continuously, or nearly continuously. ✔ You have a high number of small executions and a high execution bill, but low GB seconds in the Consumption plan. ✔ You need more CPU or memory options than what is provided by the Consumption plan. ✔ Your code needs to run longer than the maximum execution time allowed on the Consumption plan. ✔ You require features that aren’t available on the Consumption plan, such as virtual network connectivity. ✔ You want to provide a custom Linux image on which to run your functions.
Dedicated planRun your functions within an App Service plan at regular App Service plan rates.   Best for long-running scenarios where Durable Functions can’t be used. Consider an App Service plan in the following situations:   ✔ You have existing, underutilized VMs that are already running other App Service instances. ✔ Predictive scaling and costs are required.

Hosting options details:

Hosting optionDetails
ASEApp Service Environment (ASE) is an App Service feature that provides a fully isolated and dedicated environment for securely running App Service apps at high scale.   ASEs are appropriate for application workloads that require:   ✔ Very high scale. ✔ Full compute isolation and secure network access. ✔ High memory usage.
Azure Container AppsAzure Container Apps is a fully managed environment that enables you to run microservices and containerized applications on a serverless platform. Azure Container Apps let you run your functions with the power of the underlying Azure Kubernetes Service (AKS) while removing the complexity of having to work with Kubernetes APIs.
Kubernetes (Direct or Azure Arc)Kubernetes provides a fully isolated and dedicated environment running on top of the Kubernetes platform.   Kubernetes is appropriate for application workloads that require: ✔ Custom hardware requirements. ✔ Isolation and secure network access. ✔ Ability to run in hybrid or multi-cloud environment. ✔ Run alongside existing Kubernetes applications and services.

Function app timeout duration

The timeout duration for functions in a function app is defined by the functionTimeout property in the host.json project file. This property applies specifically to function executions. After the trigger starts function execution, the function needs to return/respond within the timeout duration. For more information, see Improve Azure Functions performance and reliability.

The following table shows the default and maximum values (in minutes) for specific plans:

PlanDefaultMaximum1
Consumption plan510
Premium plan302Unlimited3
Dedicated plan302Unlimited3

Scale

From <https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#overview-of-plans>

The following table compares the scaling behaviors of the various hosting plans.

Maximum instances are given on a per-function app (Consumption) or per-plan (Premium/Dedicated) basis, unless otherwise indicated.

PlanScale outMax # instances
Consumption planEvent driven. Scale out automatically, even during periods of high load. Azure Functions infrastructure scales CPU and memory resources by adding additional instances of the Functions host, based on the number of incoming trigger events.Windows: 200 Linux: 1001
Premium planEvent driven. Scale out automatically, even during periods of high load. Azure Functions infrastructure scales CPU and memory resources by adding additional instances of the Functions host, based on the number of events that its functions are triggered on.Windows: 100 Linux: 20-1002
Dedicated plan3Manual/autoscale10-30
ASE3Manual/autoscale100
KubernetesEvent-driven autoscale for Kubernetes clusters using KEDA.Varies by cluster  

Service limits

From <https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#overview-of-plans>

The comparison tables in this article also include the following hosting options, which provide the highest amount of control and isolation in which to run your function apps.

Expand table

ResourceConsumption planPremium planDedicated planASEKubernetes
Default timeout duration (min)5303013030
Max timeout duration (min)10unbounded7unbounded2unboundedunbounded
Max outbound connections (per instance)600 active (1200 total)unboundedunboundedunboundedunbounded
Max request size (MB)3100100100100Depends on cluster
Max query string length34096409640964096Depends on cluster
Max request URL length38192819281928192Depends on cluster
ACU per instance100210-840100-840210-2508AKS pricing
Max memory (GB per instance)1.53.5-141.75-143.5 – 14Any node is supported
Max instance count (Windows/Linux)200/100100/20varies by SKU91009Depends on cluster
Function apps per plan11100100unbounded4unboundedunbounded
App Service plans100 per region100 per resource group100 per resource group
Deployment slots per app10231-20920n/a
Storage55 GB250 GB50-1000 GB1 TBn/a
Custom domains per app5006500500500n/a
Custom domain SSL supportunbounded SNI SSL connection includedunbounded SNI SSL and 1 IP SSL connections includedunbounded SNI SSL and 1 IP SSL connections includedunbounded SNI SSL and 1 IP SSL connections includedn/a

Networking features

FeatureConsumption planPremium planDedicated planASE
Inbound IP restrictions✅Yes✅Yes✅Yes✅Yes
Inbound Private Endpoints❌No✅Yes✅Yes✅Yes
Virtual network integration❌No✅Yes (Regional)✅Yes (Regional and Gateway)✅Yes
Virtual network triggers (non-HTTP)❌No✅Yes✅Yes✅Yes
Hybrid connections (Windows only)❌No✅Yes✅Yes✅Yes
Outbound IP restrictions❌No✅Yes✅Yes✅Yes

Billing

From <https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#overview-of-plans>

PlanDetails
Consumption planPay only for the time your functions run. Billing is based on number of executions, execution time, and memory used.
Premium planPremium plan is based on the number of core seconds and memory used across needed and pre-warmed instances. At least one instance per plan must always be kept warm. This plan provides the most predictable pricing.
Dedicated planYou pay the same for function apps in an App Service Plan as you would for other App Service resources, like web apps.
App Service Environment (ASE)There’s a flat monthly rate for an ASE that pays for the infrastructure and doesn’t change with the size of the ASE. There’s also a cost per App Service plan vCPU. All apps hosted in an ASE are in the Isolated pricing SKU.
KubernetesYou pay only the costs of your Kubernetes cluster; no additional billing for Functions. Your function app runs as an application workload on top of your cluster, just like a regular app.

Conclusion

Azure Functions’ various hosting plans ensure that you can select the right balance of performance and cost for your application’s needs. Whether you’re looking for a fully serverless option with the Consumption Plan, more power and features with the Premium Plan, or consistent performance with the Dedicated Plan, Azure Functions has you covered. Container support further enhances its flexibility, making it a robust solution for modern cloud applications. This scalability is a key advantage, allowing your functions to adapt to demand while optimizing costs.

References:

Azure Functions scale and hosting | Microsoft Learn

Exit mobile version