Skip to content

Commit b3ea859

Browse files
authored
Merge pull request #209492 from nzthiago/master
Azure Functions availability zones updates and other small contributions
2 parents a9dbbb0 + e77b478 commit b3ea859

File tree

8 files changed

+144
-51
lines changed

8 files changed

+144
-51
lines changed

articles/app-service/monitor-instances-health-check.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ keywords: azure app service, web app, health check, route traffic, healthy insta
55
author: msangapu-msft
66

77
ms.topic: article
8-
ms.date: 07/19/2021
8+
ms.date: 08/26/2022
99
ms.author: msangapu
1010
ms.custom: contperf-fy22q1
1111
---
1212

1313
# Monitor App Service instances using Health check
1414

15-
This article uses Health check in the Azure portal to monitor App Service instances. Health check increases your application's availability by re-routing requests away from unhealthy instances, and replacing instances if they remain unhealthy. Your [App Service plan](./overview-hosting-plans.md) should be scaled to two or more instances to fully utilize Health check. The Health check path should check critical components of your application. For example, if your application depends on a database and a messaging system, the Health check endpoint should connect to those components. If the application cannot connect to a critical component, then the path should return a 500-level response code to indicate the app is unhealthy.
15+
This article uses Health check in the Azure portal to monitor App Service instances. Health check increases your application's availability by rerouting requests away from unhealthy instances, and replacing instances if they remain unhealthy. Your [App Service plan](./overview-hosting-plans.md) should be scaled to two or more instances to fully utilize Health check. The Health check path should check critical components of your application. For example, if your application depends on a database and a messaging system, the Health check endpoint should connect to those components. If the application can't connect to a critical component, then the path should return a 500-level response code to indicate the app is unhealthy.
1616

1717
![Health check failure][1]
1818

1919
## What App Service does with Health checks
2020

2121
- When given a path on your app, Health check pings this path on all instances of your App Service app at 1-minute intervals.
22-
- If an instance doesn't respond with a status code between 200-299 (inclusive) after ten requests, App Service determines it is unhealthy and removes it. (The required number of failed requests for an instance to be deemed unhealthy is configurable to a minimum of 2 requests.)
22+
- If an instance doesn't respond with a status code between 200-299 (inclusive) after 10 requests, App Service determines it's unhealthy and removes it. (The required number of failed requests for an instance to be deemed unhealthy is configurable to a minimum of two requests.)
2323
- After removal, Health check continues to ping the unhealthy instance. If the instance begins to respond with a healthy status code (200-299) then the instance is returned to the load balancer.
2424
- If an instance remains unhealthy for one hour, it will be replaced with new instance.
2525
- When scaling out, App Service pings the Health check path to ensure new instances are ready.
@@ -36,7 +36,7 @@ This article uses Health check in the Azure portal to monitor App Service instan
3636
- To enable Health check, browse to the Azure portal and select your App Service app.
3737
- Under **Monitoring**, select **Health check**.
3838
- Select **Enable** and provide a valid URL path on your application, such as `/health` or `/api/health`.
39-
- Click **Save**.
39+
- Select **Save**.
4040

4141
> [!CAUTION]
4242
> Health check configuration changes restart your app. To minimize impact to production apps, we recommend [configuring staging slots](deploy-staging-slots.md) and swapping to production.
@@ -130,34 +130,33 @@ function envVarMatchesHeader(headerValue) {
130130

131131
## Monitoring
132132

133-
After providing your application's Health check path, you can monitor the health of your site using Azure Monitor. From the **Health check** blade in the Portal, click the **Metrics** in the top toolbar. This will open a new blade where you can see the site's historical health status and option to create a new alert rule. Health check metrics will aggregate the successful pings & display failures only when the instance was deemed unhealthy based on the health check configuration. For more information on monitoring your sites, [see the guide on Azure Monitor](web-sites-monitor.md).
133+
After providing your application's Health check path, you can monitor the health of your site using Azure Monitor. From the **Health check** blade in the Portal, select the **Metrics** in the top toolbar. This will open a new blade where you can see the site's historical health status and option to create a new alert rule. Health check metrics will aggregate the successful pings & display failures only when the instance was deemed unhealthy based on the health check configuration. For more information on monitoring your sites, [see the guide on Azure Monitor](web-sites-monitor.md).
134134

135135
## Limitations
136136

137-
- Health check should not be enabled on Premium Functions sites. Due to the rapid scaling of Premium Functions, the Health check requests can cause unnecessary fluctuations in HTTP traffic. Premium Functions have their own internal health probes that are used to inform scaling decisions.
138-
- Health check can be enabled for **Free** and **Shared** App Service Plans so you can have metrics on the site's health and set up alerts, but because **Free** and **Shared** sites cannot scale out, any unhealthy instances will not be replaced. You should scale up to the **Basic** tier or higher so you can scale out to 2 or more instances and utilize the full benefit of Health check. This is recommended for production-facing applications as it will increase your app's availability and performance.
137+
- Health check can be enabled for **Free** and **Shared** App Service Plans so you can have metrics on the site's health and setup alerts, but because **Free** and **Shared** sites can't scale out, any unhealthy instances won't be replaced. You should scale up to the **Basic** tier or higher so you can scale out to 2 or more instances and utilize the full benefit of Health check. This is recommended for production-facing applications as it will increase your app's availability and performance.
139138

140139
## Frequently Asked Questions
141140

142141
### What happens if my app is running on a single instance?
143142

144-
If your app is only scaled to one instance and becomes unhealthy, it will not be removed from the load balancer because that would take your application down entirely. Scale out to two or more instances to get the re-routing benefit of Health check. If your app is running on a single instance, you can still use Health check's [monitoring](#monitoring) feature to keep track of your application's health.
143+
If your app is only scaled to one instance and becomes unhealthy, it will not be removed from the load balancer because that would take down your application entirely. Scale out to two or more instances to get the rerouting benefit of Health check. If your app is running on a single instance, you can still use Health check's [monitoring](#monitoring) feature to keep track of your application's health.
145144

146145
### Why are the Health check request not showing in my web server logs?
147146

148-
The Health check request are sent to your site internally, so the request will not show in [the web server logs](troubleshoot-diagnostic-logs.md#enable-web-server-logging). This also means the request will have an origin of `127.0.0.1` since it the request being sent internally. You can add log statements in your Health check code to keep logs of when your Health check path is pinged.
147+
The Health check request is sent to your site internally, so the request won't show in [the web server logs](troubleshoot-diagnostic-logs.md#enable-web-server-logging). This also means the request will have an origin of `127.0.0.1` since the request is being sent internally. You can add log statements in your Health check code to keep logs of when your Health check path is pinged.
149148

150149
### Are the Health check requests sent over HTTP or HTTPS?
151150

152-
On Windows App Service, the Health check requests will be sent via HTTPS when [HTTPS Only](configure-ssl-bindings.md#enforce-https) is enabled on the site. Otherwise, they are sent over HTTP. On Linux App Service, the health check requests are only sent over HTTP and cannot be sent over HTTP**S** at this time.
151+
On Windows App Service, the Health check requests will be sent via HTTPS when [HTTPS Only](configure-ssl-bindings.md#enforce-https) is enabled on the site. Otherwise, they're sent over HTTP. On Linux App Service, the health check requests are only sent over HTTP and can't be sent over HTTP**S** at this time.
153152

154153
### What if I have multiple apps on the same App Service Plan?
155154

156-
Unhealthy instances will be always be removed from the load balancer rotation regardless of other apps on the App Service Plan (up to the percentage specified in [`WEBSITE_HEALTHCHECK_MAXUNHEALTHYWORKERPERCENT`](#configuration)). When an app on an instance remains unhealthy for over one hour, the instance will only be replaced if all other apps with Health check enabled are also unhealthy. Apps which do not have Health check enabled will not be taken into account.
155+
Unhealthy instances will always be removed from the load balancer rotation regardless of other apps on the App Service Plan (up to the percentage specified in [`WEBSITE_HEALTHCHECK_MAXUNHEALTHYWORKERPERCENT`](#configuration)). When an app on an instance remains unhealthy for over one hour, the instance will only be replaced if all other apps with Health check enabled are also unhealthy. Apps that don't have Health check enabled won't be taken into account.
157156

158157
#### Example
159158

160-
Imagine you have two applications (or one app with a slot) with Health check enabled, called App A and App B. They are on the same App Service Plan and that the Plan is scaled out to 4 instances. If App A becomes unhealthy on two instances, the load balancer will stop sending requests to App A on those two instances. Requests will still be routed to App B on those instances assuming App B is healthy. If App A remains unhealthy for over an hour on those two instances, those instances will only be replaced if App B is **also** unhealthy on those instances. If App B is healthy, the instance will not be replaced.
159+
Imagine you have two applications (or one app with a slot) with Health check enabled, called App A and App B. They are on the same App Service Plan and that the Plan is scaled out to four instances. If App A becomes unhealthy on two instances, the load balancer will stop sending requests to App A on those two instances. Requests will still be routed to App B on those instances assuming App B is healthy. If App A remains unhealthy for over an hour on those two instances, those instances will only be replaced if App B is **also** unhealthy on those instances. If App B is healthy, the instance won't be replaced.
161160

162161
![Visual diagram explaining the example scenario above.][2]
163162

@@ -170,7 +169,7 @@ In the scenario where all instances of your application are unhealthy, App Servi
170169

171170
### Does Health Check work on App Service Environments?
172171

173-
Yes, on App Service Environments (ASEs), the platform will ping your instances on the specified path and remove any unhealthy instances from the load balancer so requests will not be routed to them. However, currently these unhealthy instances will not be replaced with new instances if they remain unhealthy for 1 hour.
172+
Yes, on App Service Environments (ASEs), the platform will ping your instances on the specified path and remove any unhealthy instances from the load balancer so requests won't be routed to them. However, currently these unhealthy instances won't be replaced with new instances if they remain unhealthy for 1 hour.
174173

175174
## Next steps
176175
- [Create an Activity Log Alert to monitor all Autoscale engine operations on your subscription](https://github.com/Azure/azure-quickstart-templates/tree/master/demos/monitor-autoscale-alert)

articles/availability-zones/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
href: migrate-app-service.md
2525
- name: Application Gateway
2626
href: migrate-app-gateway-v2.md
27+
- name: Azure Functions
28+
href: migrate-functions.md
2729
- name: Cache for Redis
2830
href: migrate-cache-redis.md
2931
- name: Cognitive Search
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
3+
title: Migrate Azure Functions to availability zone support
4+
description: Learn how to migrate Azure Functions to availability zone support.
5+
author: nzthiago
6+
ms.service: azure-functions
7+
ms.topic: conceptual
8+
ms.date: 08/29/2022
9+
ms.author: thalme
10+
ms.custom: references_regions
11+
12+
---
13+
14+
# Migrate your function app to a zone-redundant plan
15+
16+
Availability zones support for Azure Functions is available on [Premium (Elastic Premium)](../azure-functions/functions-premium-plan.md) and [Dedicated (App Service)](../azure-functions/dedicated-plan.md) plans. A zone-redundant function app plan automatically balances its instances between availability zones for higher availability. This article describes how to migrate to the public multi-tenant Premium plan with availability zone support. For migration to zone redundancy on Dedicated plans, refer [here](migrate-app-service.md).
17+
18+
## Downtime requirements
19+
20+
Downtime will be dependent on how you decide to carry out the migration. Since you can't convert pre-existing Premium plans to use availability zones, migration will consist of a side-by-side deployment where you'll create new Premium plans. Downtime will depend on how you choose to redirect traffic from your old to your new availability zone enabled function app. For example, for HTTP based functions if you're using an [Application Gateway](../app-service/networking/app-gateway-with-service-endpoints.md), a [custom domain](../app-service/app-service-web-tutorial-custom-domain.md), or [Azure Front Door](../frontdoor/front-door-overview.md), downtime will be dependent on the time it takes to update those respective services with your new app's information. Alternatively, you can route traffic to multiple apps at the same time using a service such as [Azure Traffic Manager](../app-service/web-sites-traffic-manager.md) and only fully cutover to your new availability zone enabled apps when everything is deployed and fully tested. You can also [write defensive functions](../azure-functions/performance-reliability.md#write-defensive-functions) to ensure messages are not lost during the migration for non-HTTP functions.
21+
22+
## Migration guidance: Redeployment
23+
24+
If you want your function app to use availability zones, redeploy your app into a newly created availability zone enabled Premium function app plan.
25+
26+
## How to redeploy
27+
28+
The following steps describe how to enable availability zones.
29+
30+
1. If you're already using the Premium SKU and are in one of the [supported regions](../azure-functions/azure-functions-az-redundancy.md#regional-availability), you can move on to the next step. Otherwise, you should create a new resource group in one of the supported regions.
31+
1. Create a Premium plan in one of the supported regions and the resource group. Ensure the [new Premium plan has zone redundancy enabled](../azure-functions/azure-functions-az-redundancy.md#how-to-deploy-a-function-app-on-a-zone-redundant-premium-plan).
32+
1. Create and deploy your function apps into the new Premium plan using your desired [deployment method](../azure-functions/functions-deployment-technologies.md).
33+
1. After testing and enabling the new function apps, you can optionally disable or delete your previous non-availability zone apps.
34+
35+
## Next steps
36+
37+
> [!div class="nextstepaction"]
38+
> [Learn about the Azure Functions Premium plan](../azure-functions/functions-premium-plan.md)
39+
40+
> [!div class="nextstepaction"]
41+
> [Learn about Azure Functions support for availability zone redundancy](../azure-functions/azure-functions-az-redundancy.md)
42+
43+
> [!div class="nextstepaction"]
44+
> [ARM Quickstart Templates](https://azure.microsoft.com/resources/templates/)
45+
46+
> [!div class="nextstepaction"]
47+
> [Azure Functions geo-disaster recovery](../azure-functions/functions-geo-disaster-recovery.md)

articles/azure-functions/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@
416416
href: functions-geo-disaster-recovery.md
417417
- name: Move across regions
418418
href: functions-move-across-regions.md
419+
- name: Migrate to a zone-redundant plan
420+
href: ../availability-zones/migrate-functions.md?toc=%2fazure%2fazure-functions%2ftoc.json
419421
- name: Monitor
420422
items:
421423
- name: Monitor function apps with Azure Monitor

0 commit comments

Comments
 (0)