Skip to content

Commit d97024c

Browse files
authored
Merge pull request #207309 from nzthiago/master
Updating Functions Premium Plan with more info on always ready and pre-warmed
2 parents c62189d + b444af5 commit d97024c

File tree

3 files changed

+42
-36
lines changed

3 files changed

+42
-36
lines changed

articles/azure-functions/functions-premium-plan.md

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
---
22
title: Azure Functions Premium plan
33
description: Details and configuration options (VNet, no cold start, unlimited execution duration) for the Azure Functions Premium plan.
4-
author: cachai2
4+
author: nzthiago
55
ms.topic: conceptual
6-
ms.date: 08/28/2020
7-
ms.author: cachai
6+
ms.date: 08/08/2022
7+
ms.author: thalme
88
ms.custom: references_regions, fasttrack-edit, devx-track-azurecli
99
---
1010

1111
# Azure Functions Premium plan
1212

1313
The Azure Functions Elastic Premium plan is a dynamic scale hosting option for function apps. For other hosting plan options, see the [hosting plan article](functions-scale.md).
1414

15-
[!INCLUDE [functions-premium-plan-note](../../includes/functions-premium-plan-note.md)]
15+
[!INCLUDE [functions-premium-plan-note](../../includes/functions-premium-plan-note.md)]
1616

1717
Premium plan hosting provides the following benefits to your functions:
1818

19-
* Avoid cold starts with perpetually warm instances
19+
* Avoid cold starts with warm instances.
2020
* Virtual network connectivity.
2121
* Unlimited execution duration, with 60 minutes guaranteed.
22-
* Premium instance sizes: one core, two core, and four core instances.
22+
* [Choice of Premium instance sizes](#available-instance-skus).
2323
* More predictable pricing, compared with the Consumption plan.
2424
* High-density app allocation for plans with multiple function apps.
2525

26-
When you're using the Premium plan, instances of the Azure Functions host are added and removed based on the number of incoming events, just like the [Consumption plan](consumption-plan.md). Multiple function apps can be deployed to the same Premium plan, and the plan allows you to configure compute instance size, base plan size, and maximum plan size.
26+
When you're using the Premium plan, instances of the Azure Functions host are added and removed based on the number of incoming events, just like the [Consumption plan](consumption-plan.md). Multiple function apps can be deployed to the same Premium plan, and the plan allows you to configure compute instance size, base plan size, and maximum plan size.
2727

2828
## Billing
2929

30-
Billing for the Premium plan is based on the number of core seconds and memory allocated across instances. This billing differs from the Consumption plan, which is billed per execution and memory consumed. There is no execution charge with the Premium plan. At least one instance must be allocated at all times per plan. This billing results in a minimum monthly cost per active plan, regardless if the function is active or idle. Keep in mind that all function apps in a Premium plan share allocated instances. To learn more, see the [Azure Functions pricing page](https://azure.microsoft.com/pricing/details/functions/).
30+
Billing for the Premium plan is based on the number of core seconds and memory allocated across instances. This billing differs from the Consumption plan, which is billed based on per-second resource consumption and executions. There's no execution charge with the Premium plan. This billing results in a minimum monthly cost per active plan, regardless if the function is active or idle. Keep in mind that all function apps in a Premium plan share allocated instances. To learn more, see the [Azure Functions pricing page](https://azure.microsoft.com/pricing/details/functions/).
31+
32+
> [!NOTE]
33+
> Every premium plan has at least one active (billed) instance at all times.
3134
3235
## Create a Premium plan
3336

34-
When you create a function app in the Azure portal, the Consumption plan is the default. To create a function app that runs in a Premium plan, you must explicitly create an App Service plan using one of the _Elastic Premium_ SKUs. The function app you create is then hosted in this plan. The Azure portal makes it easy to create both the Premium plan and the function app at the same time. You can run more than one function app in the same Premium plan, but they must both run on the same operating system (Windows or Linux).
37+
When you create a function app in the Azure portal, the Consumption plan is the default. To create a function app that runs in a Premium plan, you must explicitly create or choose an Azure Functions Premium hosting plan using one of the _Elastic Premium_ SKUs. The function app you create is then hosted in this plan. The Azure portal makes it easy to create both the Premium plan and the function app at the same time. You can run more than one function app in the same Premium plan, but they must both run on the same operating system (Windows or Linux).
3538

3639
The following articles show you how to create a function app with a Premium plan, either programmatically or in the Azure portal:
3740

@@ -41,16 +44,17 @@ The following articles show you how to create a function app with a Premium plan
4144

4245
## Eliminate cold starts
4346

44-
When events or executions don't occur in the Consumption plan, your app may scale to zero instances. When new events come in, a new instance with your app running on it must be specialized. Specializing new instances may take some time depending on the app. This additional latency on the first call is often called app _cold start_.
47+
When events or executions don't occur in the Consumption plan, your app may scale to zero instances. When new events come in, a new instance with your app running on it must be specialized. Specializing new instances may take some time depending on the app. This extra latency on the first call is often called app _cold start_.
4548

46-
Premium plan provides two features that work together to effectively eliminate cold starts in your functions: _always ready instances_ and _pre-warmed instances_.
49+
Premium plan provides two features that work together to effectively eliminate cold starts in your functions: _always ready instances_ and _pre-warmed instances_. Always ready instances are a number of pre-allocated instances unaffected by scaling, and the pre-warmed ones are a buffer as you scale due to HTTP events.
50+
51+
When events begin to trigger the app, they're first routed to the always ready instances. As the function becomes active due to HTTP events, additional instances will be warmed as a buffer. These buffered instances are called pre-warmed instances. This buffer reduces cold start for new instances required during scale.
4752

4853
### Always ready instances
4954

50-
In the Premium plan, you can have your app always ready on a specified number of instances. The maximum number of always ready instances is 20. When events begin to trigger the app, they are first routed to the always ready instances. As the function becomes active, additional instances will be warmed as a buffer. This buffer prevents cold start for new instances required during scale. These buffered instances are called [pre-warmed instances](#pre-warmed-instances). With the combination of the always ready instances and a pre-warmed buffer, your app can effectively eliminate cold start.
55+
In the Premium plan, you can have your app always ready on a specified number of instances. Your app runs continuously on those instances, regardless of load. If load exceeds what your always ready instances can handle, additional instances are added as necessary, up to your specified maximum.
5156

52-
> [!NOTE]
53-
> Every premium plan has at least one active (billed) instance at all times.
57+
This app-level setting also controls your plan's minimum instances. For example, consider having three function apps in the same Premium plan. When two of your apps have always ready set to one and the third has it set to five, the minimum for your whole plan is five. This also reflects the minimum number of instances for which your plan is billed. The maximum number of always ready instances we support per app is 20.
5458

5559
# [Portal](#tab/portal)
5660

@@ -63,54 +67,57 @@ You can configure the number of always ready instances in the Azure portal by se
6367
You can also configure always ready instances for an app with the Azure CLI.
6468

6569
```azurecli-interactive
66-
az resource update -g <resource_group> -n <function_app_name>/config/web --set properties.minimumElasticInstanceCount=<desired_always_ready_count> --resource-type Microsoft.Web/sites
70+
az functionapp update -g <RESOURCE_GROUP> -n <FUNCTION_APP_NAME> --set siteConfig.minimumElasticInstanceCount=<YOUR_ALWAYS_READY_COUNT>
6771
```
6872

69-
# [Azure PowerShell](#tab/azure-powershell)
73+
# [Azure PowerShell](#tab/azure-powershell)
7074

7175
You can also configure always ready instances for an app with the Azure PowerShell.
7276

7377
```azurepowershell-interactive
74-
$Resource = Get-AzResource -ResourceGroupName <resource_group> -ResourceName <function_app_name>/config/web -ResourceType Microsoft.Web/sites
75-
$Resource.Properties.minimumElasticInstanceCount = <desired_always_ready_count>
78+
$Resource = Get-AzResource -ResourceGroupName <RESOURCE_GROUP> -ResourceName <FUNCTION_APP_NAME>/config/web -ResourceType Microsoft.Web/sites
79+
$Resource.Properties.minimumElasticInstanceCount = <YOUR_ALWAYS_READY_COUNT>
7680
$Resource | Set-AzResource -Force
7781
```
7882

7983
---
8084

8185
### Pre-warmed instances
8286

83-
Pre-warmed instances are instances warmed as a buffer during scale and activation events. Pre-warmed instances continue to buffer until the maximum scale-out limit is reached. The default pre-warmed instance count is 1, and for most scenarios this value should remain as 1.
87+
The pre-warmed instance count setting provides warmed instances as a buffer during HTTP scale and activation events. Pre-warmed instances continue to buffer until the maximum scale-out limit is reached. The default pre-warmed instance count is 1 and, for most scenarios, this value should remain as 1.
8488

85-
When an app has a long warm-up (like a custom container image), you may need to increase this buffer. A pre-warmed instance becomes active only after all active instances have been sufficiently used.
89+
Consider a less-common scenario, such as an app running in a custom container. Because custom containers have a long warm-up, you may consider increasing this buffer of pre-warmed instances. A pre-warmed instance becomes active only after all active instances are in use.
8690

8791
You can also define a warmup trigger that is run during the pre-warming process. You can use a warmup trigger to pre-load custom dependencies during the pre-warming process so your functions are ready to start processing requests immediately. To learn more, see [Azure Functions warmup trigger](functions-bindings-warmup.md).
8892

89-
Consider this example of how always-ready instances and pre-warmed instances work together. A premium function app has five always ready instances configured, and the default of one pre-warmed instance. When the app is idle and no events are triggering, the app is provisioned and running with five instances. At this time, you aren't billed for a pre-warmed instance as the always-ready instances aren't used, and no pre-warmed instance is allocated.
93+
Consider this example of how always-ready instances and pre-warmed instances work together. A premium function app has two always ready instances configured, and the default of one pre-warmed instance.
9094

91-
As soon as the first trigger comes in, the five always-ready instances become active, and a pre-warmed instance is allocated. The app is now running with six provisioned instances: the five now-active always ready instances, and the sixth pre-warmed and inactive buffer. If the rate of executions continues to increase, the five active instances are eventually used. When the platform decides to scale beyond five instances, it scales into the pre-warmed instance. When that happens, there are now six active instances, and a seventh instance is instantly provisioned and fill the pre-warmed buffer. This sequence of scaling and pre-warming continues until the maximum instance count for the app is reached. No instances are pre-warmed or activated beyond the maximum.
95+
![Scale out graph](./media/functions-premium-plan/scale-graph.png)
9296

93-
# [Portal](#tab/portal)
97+
1. When the app is idle and no events are triggering, the app is provisioned and running with two instances. At this time, you're billed for the two always ready instances but aren't billed for a pre-warmed instance as no pre-warmed instance is allocated.
98+
2. As your application starts receiving HTTP traffic, requests will be load balanced across the two always-ready instances. As soon as those two instances start processing events, an instance gets added to fill the pre-warmed buffer. The app is now running with three provisioned instances: the two always ready instances, and the third pre-warmed and inactive buffer. You're billed for the three instances.
99+
3. As load increases and your app needs more instances to handle HTTP traffic, that prewarmed instance is swapped to an active instance. HTTP load is now routed to all three instances, and a fourth instance is instantly provisioned to fill the pre-warmed buffer.
100+
4. This sequence of scaling and pre-warming continues until the maximum instance count for the app is reached or load decreases causing the platform to scale back in after a period. No instances are pre-warmed or activated beyond the maximum.
94101

95-
You can configure the number of pre-warmed instances in the Azure portal by selecting the **Scale Out** options under **Settings** of a function app deployed to that plan and then adjusting the **Always Ready Instances** count.
102+
# [Portal](#tab/portal)
96103

97-
![Pre-warmed instance Settings in the portal](./media/functions-premium-plan/scale-out.png)
104+
You can't change the pre-warmed instance count setting in the portal, you must instead use the Azure CLI or Azure PowerShell.
98105

99106
# [Azure CLI](#tab/azurecli)
100107

101108
You can modify the number of pre-warmed instances for an app using the Azure CLI.
102109

103110
```azurecli-interactive
104-
az resource update -g <resource_group> -n <function_app_name>/config/web --set properties.preWarmedInstanceCount=<desired_prewarmed_count> --resource-type Microsoft.Web/sites
111+
az functionapp update -g <RESOURCE_GROUP> -n <FUNCTION_APP_NAME> --set siteConfig.preWarmedInstanceCount=<YOUR_PREWARMED_COUNT>
105112
```
106113

107114
# [Azure PowerShell](#tab/azure-powershell)
108115

109116
You can modify the number of pre-warmed instances for an app using the Azure PowerShell.
110117

111118
```azurepowershell-interactive
112-
$Resource = Get-AzResource -ResourceGroupName <resource_group> -ResourceName <function_app_name>/config/web -ResourceType Microsoft.Web/sites
113-
$Resource.Properties.preWarmedInstanceCount = <desired_prewarmed_count>
119+
$Resource = Get-AzResource -ResourceGroupName <RESOURCE_GROUP> -ResourceName <FUNCTION_APP_NAME>/config/web -ResourceType Microsoft.Web/sites
120+
$Resource.Properties.preWarmedInstanceCount = <YOUR_PREWARMED_COUNT>
114121
$Resource | Set-AzResource -Force
115122
```
116123

@@ -148,7 +155,7 @@ This migration isn't supported on Linux.
148155

149156
When you create the plan, there are two plan size settings: the minimum number of instances (or plan size) and the maximum burst limit.
150157

151-
If your app requires instances beyond the always-ready instances, it can continue to scale out until the number of instances hits the maximum burst limit. You're billed for instances beyond your plan size only while they are running and allocated to you, on a per-second basis. The platform makes it's best effort at scaling your app out to the defined maximum limit.
158+
If your app requires instances beyond the always-ready instances, it can continue to scale out until the number of instances hits the maximum burst limit. You're billed for instances beyond your plan size only while they're running and allocated to you, on a per-second basis. The platform makes its best effort at scaling your app out to the defined maximum limit.
152159

153160
# [Portal](#tab/portal)
154161

@@ -161,19 +168,18 @@ You can configure the plan size and maximums in the Azure portal by selecting th
161168
You can also increase the maximum burst limit from the Azure CLI:
162169

163170
```azurecli-interactive
164-
az functionapp plan update -g <resource_group> -n <premium_plan_name> --max-burst <desired_max_burst>
171+
az functionapp plan update -g <RESOURCE_GROUP> -n <PREMIUM_PLAN_NAME> --max-burst <YOUR_MAX_BURST>
165172
```
166173

167174
# [Azure PowerShell](#tab/azure-powershell)
168175

169176
You can also increase the maximum burst limit from the Azure PowerShell:
170177

171178
```azurepowershell-interactive
172-
Update-AzFunctionAppPlan -ResourceGroupName <resource_group> -Name <premium_plan_name> -MaximumWorkerCount <desired_max_burst> -Force
179+
Update-AzFunctionAppPlan -ResourceGroupName <RESOURCE_GROUP> -Name <PREMIUM_PLAN_NAME> -MaximumWorkerCount <YOUR_MAX_BURST> -Force
173180
```
174181

175182
---
176-
177183
The minimum for every plan will be at least one instance. The actual minimum number of instances will be autoconfigured for you based on the always ready instances requested by apps in the plan. For example, if app A requests five always ready instances, and app B requests two always ready instances in the same plan, the minimum plan size will be calculated as five. App A will be running on all 5, and app B will only be running on 2.
178184

179185
> [!IMPORTANT]
@@ -192,22 +198,22 @@ You can configure the minimum instances in the Azure portal by selecting the **S
192198
Increasing the calculated minimum for a plan can be done using the Azure CLI.
193199

194200
```azurecli-interactive
195-
az functionapp plan update -g <resource_group> -n <premium_plan_name> --min-instances <desired_min_instances>
201+
az functionapp plan update -g <RESOURCE_GROUP> -n <PREMIUM_PLAN_NAME> --min-instances <YOUR_MIN_INSTANCES>
196202
```
197203

198204
# [Azure PowerShell](#tab/azure-powershell)
199205

200206
Increasing the calculated minimum for a plan can be done using the Azure PowerShell.
201207

202208
```azurepowershell-interactive
203-
Update-AzFunctionAppPlan -ResourceGroupName <resource_group> -Name <premium_plan_name> -MinimumWorkerCount <desired_min_instances> -Force
209+
Update-AzFunctionAppPlan -ResourceGroupName <RESOURCE_GROUP> -Name <PREMIUM_PLAN_NAME> -MinimumWorkerCount <YOUR_MIN_INSTANCES> -Force
204210
```
205211

206212
---
207213

208214
### Available instance SKUs
209215

210-
When creating or scaling your plan, you can choose between three instance sizes. You will be billed for the total number of cores and memory provisioned, per second that each instance is allocated to you. Your app can automatically scale out to multiple instances as needed.
216+
When creating or scaling your plan, you can choose between three instance sizes. You'll be billed for the total number of cores and memory provisioned, per second that each instance is allocated to you. Your app can automatically scale out to multiple instances as needed.
211217

212218
|SKU|Cores|Memory|Storage|
213219
|--|--|--|--|
16.7 KB
Loading

includes/functions-premium-plan-note.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ ms.author: glenga
77
---
88

99
>[!IMPORTANT]
10-
>Azure Functions runs on the Azure App Service platform. In the App Service platform, plans that host Premium plan function apps are referred to as *Elastic* Premium plans, with SKU names like `EP1`. If you choose to run your function app on a Premium plan, make sure to create a plan with an SKU name that starts with "E", such as `EP1`. App Service plan SKU names that start with "P", such as `P1V2` (Premium V2 Small plan), are actually [Dedicated hosting plans](../articles/azure-functions/dedicated-plan.md). Because they are Dedicated and not Elastic Premium, plans with SKU names starting with "P" won't scale dynamically and may increase your costs.
10+
>Azure Functions can run on the Azure App Service platform. In the App Service platform, plans that host Premium plan function apps are referred to as *Elastic* Premium plans, with SKU names like `EP1`. If you choose to run your function app on a Premium plan, make sure to create a plan with an SKU name that starts with "E", such as `EP1`. App Service plan SKU names that start with "P", such as `P1V2` (Premium V2 Small plan), are actually [Dedicated hosting plans](../articles/azure-functions/dedicated-plan.md). Because they are Dedicated and not Elastic Premium, plans with SKU names starting with "P" won't scale dynamically and may increase your costs.

0 commit comments

Comments
 (0)