Reputation: 17101
My understanding is that when an App Service "scale unit" - i.e. a collection of virtual machines within an Azure region - gets upgraded, they are upgraded in batches called "upgrade domains" which you share with other tenants.
When an upgrade domain is complete then applications are moved onto it. This will result in a cold start and it's advised to use the AppInit module... all great so far.
What I'm unclear on is twofold:
A. When apps are moved to freshly upgraded upgrade-domains, does the load balancer wait until warmup is complete before swapping over? Similar to how it waits for slot swaps?
B. Are scaled out instances always on different upgrade domains? If A is not the case, then are scaled out instances purposefully less prone to upgrade-induced cold starts or perhaps they are less prone down to chance of what upgrade domain is done when?
To clarify:
For A. Does the App still run on the old pre-upgraded "upgrade domain" whilst the newly upgraded upgrade-domain is warmed up and then the front end swaps to it?
Or is it unlike a slot swap and app is transitions to the new VM disregarding it's warm up state? And the AppInit then kicks in?
Upvotes: 1
Views: 262
Reputation: 1811
With the AppInit feature, as new web app instances are added into rotation, we ensure that the Application Initialization module reports that the site is fully warmed up before sending it requests from the frontend.
To use the feature, add an applicationInitialization section to your web.config like so:
<system.webServer>
<applicationInitialization remapManagedRequestsTo="/Content/warmup.html">
<add initializationPage="/api/values/100" />
</applicationInitialization>
</system.webServer>
You can have multiple initialization pages, and the AppInit module will ensure that all of them return 200 before declaring the site officially warmed up.
Meanwhile, you can (optionally) use the remapManagedRequestsTo attribute to have a friendly page showing that the site is still warming up.
Thanks to the AppInit feature, this page will not be visible to customers while adding new instances into rotation, however if a process crashes for whatever reason and enters AppInit again, it will come into play.
Upvotes: 1