Webhook or other notifications when App Service rotates the underlying instance VMs

Jon Sagara 1 Reputation point

We have our Azure App Service set to a dedicated number of instances (> 1). We have noticed in Application Insights Live Metrics that periodically, App Service will rotate out one of the underlying VMs and replace it with a new instance. We noticed this because during the rotation, the requests/sec to all instances drops to almost 0 for about a minute, before they all ramp back up to normal again.

Are there any webhooks or other notification mechanisms we can subscribe to to learn when these rotations happen, and, more importantly, why?

Are these VM swaps documented anywhere on learn?

Is there some way to prevent the requests/sec from dropping for the remaining, "healthy" VMs?

Thank you.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
4,937 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 15,036 Reputation points Microsoft Employee

    JonSagara-6725, Thanks for the question. Apologies for any inconvenience with this issue.

    By default, a client is bound to a specific instance for the life of their web session, by ARR Affinity.

    If maintaining session affinity/stateful is a requirement for your WebApp, you may enable ARR affinity setting via Azure Portal.

    As for monitor App Service instances, you may use Health check feature - which helps to monitor App Service instances. With the Health check- it increases your application's availability by rerouting requests away from unhealthy instances, and replacing instances if they remain unhealthy.

    In a nutshell, the App Service Plan (ASP) is the scale unit of the App Service Apps. If the plan is configured to run 4 VM instances, then all apps in the plan run on all 4 instances.
    --If the plan is configured for autoscaling, then all apps in the plan are scaled out together based on the autoscale settings. You pay for the ASP, not for #number Apps.

    Also, when Always On is not turned on (default), the app is unloaded after 20 minutes without any incoming requests. With Always On - Keeps the app loaded even when there's no traffic.

    Kindly let us know, I'll follow-up with you further.

    0 comments No comments