Azure Functions scale and hosting (2024)

  • Article

When you create a function app in Azure, you must choose a hosting option for your app. Azure provides you with these hosting options for your function code:

Hosting optionServiceAvailabilityContainer support
Consumption planAzure FunctionsGenerally available (GA)None
Flex Consumption planAzure FunctionsPreviewNone
Premium planAzure FunctionsGALinux
Dedicated planAzure FunctionsGALinux
Container AppsAzure Container AppsGALinux

Azure Functions hosting options are facilitated by Azure App Service infrastructure on both Linux and Windows virtual machines. The hosting option you choose dictates the following behaviors:

  • How your function app is scaled.
  • The resources available to each function app instance.
  • Support for advanced functionality, such as Azure Virtual Network connectivity.
  • Support for Linux containers.

The plan you choose also impacts the costs for running your function code. For more information, see Billing.

This article provides a detailed comparison between the various hosting options. To learn more about running and managing your function code in Linux containers, see Linux container support in Azure Functions.

Overview of plans

The following is a summary of the benefits of the various options for Azure Functions hosting:

OptionBenefits
Consumption planPay for compute resources only when your functions are running (pay-as-you-go) with automatic scale.

On the Consumption plan, instances of the Functions host are dynamically added and removed based on the number of incoming events.

✔ Default hosting plan that provides true serverless hosting.
✔ Pay only when your functions are running.
✔ Scales automatically, even during periods of high load.

Flex Consumption planGet high scalability with compute choices, virtual networking, and pay-as-you-go billing.

On the Flex Consumption plan, instances of the Functions host are dynamically added and removed based on the configured per instance concurrency and the number of incoming events.

✔ Reduce cold starts by specifying a number of pre-provisioned (always ready) instances.
✔ Supports virtual networking for added security.
✔ Pay when your functions are running.
✔ Scales automatically, even during periods of high load.

Premium planAutomatically scales based on demand using prewarmed 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 want more control of your instances and want to deploy multiple function apps on the same plan with event-driven scaling.
✔ 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 are provided by consumption plans.
✔ Your code needs to run longer than the maximum execution time allowed on the Consumption plan.
✔ You require virtual network connectivity.
✔ You want to provide a custom Linux image in 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 and underutilized virtual machines that are already running other App Service instances.
✔ You must have fully predictable billing, or you need to manually scale instances.
✔ You want to run multiple web apps and function apps on the same plan
✔ You need access to larger compute size choices.
✔ Full compute isolation and secure network access provided by an App Service Environment (ASE).
✔ Very high memory usage and high scale (ASE).

Container AppsCreate and deploy containerized function apps in a fully managed environment hosted by Azure Container Apps.

Use the Azure Functions programming model to build event-driven, serverless, cloud native function apps. Run your functions alongside other microservices, APIs, websites, and workflows as container-hosted programs. Consider hosting your functions on Container Apps in the following situations:

✔ You want to package custom libraries with your function code to support line-of-business apps.
✔ You need to migration code execution from on-premises or legacy apps to cloud native microservices running in containers.
✔ When you want to avoid the overhead and complexity of managing Kubernetes clusters and dedicated compute.
✔ Your functions need high-end processing power provided by dedicated GPU compute resources.

The remaining tables in this article compare hosting options based on various features and behaviors.

Operating system support

This table shows operating system support for the hosting options.

HostingLinux1 deploymentWindows2 deployment
Consumption plan✅ Code-only
❌ Container (not supported)
✅ Code-only
Flex Consumption plan✅ Code-only
❌ Container (not supported)
❌ Not supported
Premium plan✅ Code-only
✅ Container
✅ Code-only
Dedicated plan✅ Code-only
✅ Container
✅ Code-only
Container Apps✅ Container-only❌ Not supported
  1. Linux is the only supported operating system for the Python runtime stack.
  2. Windows deployments are code-only. Functions doesn't currently support Windows containers.

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. To avoid timeouts, it's important to write robust functions. 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
Flex Consumption plan30Unbounded2
Premium plan304Unbounded2
Dedicated plan304Unbounded3
Container Apps30Unbounded4
  1. Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request. This is because of the default idle timeout of Azure Load Balancer. For longer processing times, consider using the Durable Functions async pattern or defer the actual work and return an immediate response.
  2. There is no maximum execution timeout duration enforced. However, the grace period given to a function execution is 60 minutes during scale in for the Flex Consumption and Premium plans, and a grace period of 10 minutes is given during platform updates.
  3. Requires the App Service plan be set to Always On. A grace period of 10 minutes is given during platform updates.
  4. The default timeout for version 1.x of the Functions host runtime is unbounded.
  5. When the minimum number of replicas is set to zero, the default timeout depends on the specific triggers used in the app.

Language support

For details on current native language stack support in Functions, see Supported languages in Azure Functions.

Scale

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. Scales out automatically, even during periods of high load. Functions infrastructure scales CPU and memory resources by adding more instances of the Functions host, based on the number of incoming trigger events.Windows: 200
Linux: 1001
Flex Consumption planPer-function scaling. Event-driven scaling decisions are calculated on a per-function basis, which provides a more deterministic way of scaling the functions in your app. With the exception of HTTP, Blob storage (Event Grid), and Durable Functions, all other function trigger types in your app scale on independent instances. All HTTP triggers in your app scale together as a group on the same instances, as do all Blob storage (Event Grid) triggers. All Durable Functions triggers also share instances and scale together.Limited only by total memory usage of all instances across a given region. For more information, see Instance memory.
Premium planEvent driven. Scale out automatically, even during periods of high load. Azure Functions infrastructure scales CPU and memory resources by adding more 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
100 (ASE)
Container AppsEvent driven. Scale out automatically, even during periods of high load. Azure Functions infrastructure scales CPU and memory resources by adding more instances of the Functions host, based on the number of events that its functions are triggered on.300-10004
  1. During scale-out, there's currently a limit of 500 instances per subscription per hour for Linux apps on a Consumption plan.
  2. In some regions, Linux apps on a Premium plan can scale to 100 instances. For more information, see the Premium plan article.
  3. For specific limits for the various App Service plan options, see the App Service plan limits.
  4. On Container Apps, the default is 10 instances, but you can set the maximum number of replicas, which has an overall maximum of 1000. This setting is honored as long as there's enough cores quota available. When you create your function app from the Azure portal you're limited to 300 instances.

Cold start behavior

PlanDetails
Consumption planApps can scale to zero when idle, meaning some requests might have more latency at startup. The consumption plan does have some optimizations to help decrease cold start time, including pulling from prewarmed placeholder functions that already have the host and language processes running.
Flex Consumption planSupports always ready instances to reduce the delay when provisioning new instances.
Premium planSupports always ready instances to avoid cold starts by letting you maintain one or more perpetually warm instances.
Dedicated planWhen running in a Dedicated plan, the Functions host can run continuously on a prescribed number of instances, which means that cold start isn't really an issue.
Container AppsDepends on the minimum number of replicas:
• When set to zero: apps can scale to zero when idle and some requests might have more latency at startup.
• When set to one or more: the host process runs continuously, which means that cold start isn't an issue.

Service limits

ResourceConsumption planFlex Consumption plan13Premium planDedicated plan/ASEContainer Apps
Default timeout duration (min)530303013016
Max timeout duration (min)10unbounded8unbounded8unbounded2unbounded17
Max outbound connections (per instance)600 active (1200 total)unboundedunboundedunboundedunbounded
Max request size (MB)3100100100100100
Max query string length340964096409640964096
Max request URL length381928192819281928192
ACU per instance100varies210-840100-840/210-2509varies
Max memory (GB per instance)1.54143.5-141.75-14/3.5-14varies
Max instance count (Windows/Linux)200/1001000 15100/20varies by SKU/1001010-30018
Function apps per plan12100100100unbounded4unbounded4
App Service plans100 per regionn/a100 per resource group100 per resource groupn/a
Deployment slots per app112n/a31-2010not supported
Storage (temporary)50.5 GB0.8 GB21-140 GB11-140 GBn/a
Storage (persisted)1 GB60 GB6250 GB10-1000 GB10n/a
Custom domains per app5007500500500not supported
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 includednot supported

Notes on service limits:

  1. By default, the timeout for the Functions 1.x runtime in an App Service plan is unbounded.
  2. Requires the App Service plan be set to Always On. Pay at standard rates. A grace period of 10 minutes is given during platform updates.
  3. These limits are set in the host.
  4. The actual number of function apps that you can host depends on the activity of the apps, the size of the machine instances, and the corresponding resource utilization.
  5. The storage limit is the total content size in temporary storage across all apps in the same App Service plan. For Consumption plans on Linux, the storage is currently 1.5 GB.
  6. Consumption plan uses an Azure Files share for persisted storage. When you provide your own Azure Files share, the specific share size limits depend on the storage account you set for WEBSITE_CONTENTAZUREFILECONNECTIONSTRING. On Linux, you must explicitly mount your own Azure Files share for both Flex Consumption and Consumption plans.
  7. When your function app is hosted in a Consumption plan, only the CNAME option is supported. For function apps in a Premium plan or an App Service plan, you can map a custom domain using either a CNAME or an A record.
  8. There is no maximum execution timeout duration enforced. However, the grace period given to a function execution is 60 minutes during scale in and 10 minutes during platform updates.
  9. Workers are roles that host customer apps. Workers are available in three fixed sizes: One vCPU/3.5 GB RAM; Two vCPU/7 GB RAM; Four vCPU/14 GB RAM.
  10. See App Service limits for details.
  11. Including the production slot.
  12. There's currently a limit of 5000 function apps in a given subscription.
  13. The Flex Consumption plan is currently in preview.
  14. Flex Consumption plan instance sizes are currently defined as either 2,048 MB or 4,096 MB. For more information, see Instance memory.
  15. Flex Consumption plan during preview has a regional subscription quota that limits the total memory usage of all instances across a given region. For more information, see Instance memory.
  16. When the minimum number of replicas is set to zero, the default timeout depends on the specific triggers used in the app.
  17. When the minimum number of replicas is set to one or more.
  18. On Container Apps, you can set the maximum number of replicas, which is honored as long as there's enough cores quota available.

Networking features

FeatureConsumption planFlex Consumption planPremium planDedicated plan/ASEContainer Apps*
Inbound IP restrictions✅Yes✅Yes✅Yes✅Yes✅Yes
Inbound Private Endpoints❌No✅Yes✅Yes✅Yes❌No
Virtual network integration❌No✅Yes (Regional)✅Yes (Regional)✅Yes (Regional and Gateway)✅Yes
Virtual network triggers (non-HTTP)❌No✅Yes✅Yes✅Yes✅Yes
Hybrid connections (Windows only)❌No❌ No✅Yes✅Yes❌No
Outbound IP restrictions❌No✅Yes✅Yes✅Yes✅Yes

*For more information, see Networking in Azure Container Apps environment.

Billing

PlanDetails
Consumption planPay only for the time your functions run. Billing is based on number of executions, execution time, and memory used.
Flex Consumption planBilling is based on number of executions, the memory of instances when they're actively executing functions, plus the cost of any always ready instances. For more information, see Flex Consumption plan billing.
Premium planPremium plan is based on the number of core seconds and memory used across needed and prewarmed 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.

For an ASE, there's a flat monthly rate that pays for the infrastructure and doesn't change with the size of the environment. There's also a cost per App Service plan vCPU. All apps hosted in an ASE are in the Isolated pricing SKU. For more information, see the ASE overview article.

Container AppsBilling in Azure Container Apps is based on your plan type. For more information, see Billing in Azure Container Apps.

For a direct cost comparison between dynamic hosting plans (Consumption, Flex Consumption, and Premium), see the Azure Functions pricing page. For pricing of the various Dedicated plan options, see the App Service pricing page. For pricing Container Apps hosting, see Azure Container Apps pricing.

Limitations for creating new function apps in an existing resource group

In some cases, when trying to create a new hosting plan for your function app in an existing resource group you might receive one of the following errors:

  • The pricing tier is not allowed in this resource group
  • <SKU_name> workers are not available in resource group <resource_group_name>

This can happen when the following conditions are met:

  • You create a function app in an existing resource group that has ever contained another function app or web app. For example, Linux Consumption apps aren't supported in the same resource group as Linux Dedicated or Linux Premium plans.
  • Your new function app is created in the same region as the previous app.
  • The previous app is in some way incompatible with your new app. This error can happen between SKUs, operating systems, or due to other platform-level features, such as availability zone support.

The reason this happens is due to how function app and web app plans are mapped to different pools of resources when being created. Different SKUs require a different set of infrastructure capabilities. When you create an app in a resource group, that resource group is mapped and assigned to a specific pool of resources. If you try to create another plan in that resource group and the mapped pool does not have the required resources, this error occurs.

When this error occurs, instead create your function app and hosting plan in a new resource group.

Next steps

  • Deployment technologies in Azure Functions
  • Azure Functions developer guide
Azure Functions scale and hosting (2024)
Top Articles
Replace pre-shared keys for VPNs
Beauty Benefits Of Jogging
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Zonia Mosciski DO

Last Updated:

Views: 5510

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Zonia Mosciski DO

Birthday: 1996-05-16

Address: Suite 228 919 Deana Ford, Lake Meridithberg, NE 60017-4257

Phone: +2613987384138

Job: Chief Retail Officer

Hobby: Tai chi, Dowsing, Poi, Letterboxing, Watching movies, Video gaming, Singing

Introduction: My name is Zonia Mosciski DO, I am a enchanting, joyous, lovely, successful, hilarious, tender, outstanding person who loves writing and wants to share my knowledge and understanding with you.