From ff0729e3377d1e033c94f2c707b8e30d18d70d41 Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Wed, 22 May 2024 17:44:12 -0700 Subject: [PATCH] Document ShutdownDelay (#32637) * Document ShutdownDelay * fix capitalization * Apply suggestions from code review Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> * Update aspnetcore/host-and-deploy/iis/advanced.md --------- Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> --- aspnetcore/host-and-deploy/iis/advanced.md | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/aspnetcore/host-and-deploy/iis/advanced.md b/aspnetcore/host-and-deploy/iis/advanced.md index d3bf775eae..235c6a0112 100644 --- a/aspnetcore/host-and-deploy/iis/advanced.md +++ b/aspnetcore/host-and-deploy/iis/advanced.md @@ -48,6 +48,29 @@ The `disallowRotationOnConfigChange` setting is intended for blue/green scenario This setting corresponds to the API +## Reduce 503 likelihood during app recycle + +By default there is a one second delay between when IIS is notified of a recycle or shutdown and when ANCM tells the managed server to initiate shutdown. The delay is configurable via the `ANCM_shutdownDelay` environment variable or by setting the `shutdownDelay` handler setting. Both values are in milliseconds. The delay is primarily to reduce the likelihood of a race where: + +* IIS hasn't started queuing requests to go to the new app. +* ANCM starts rejecting new requests that come into the old app. + +This setting doesn't mean incoming requests will be delayed by this amount. The setting indicates that the old app instance will start shutting down after the timeout occurs. Slower machines or machines with heavier CPU usage might need to adjust this value to reduce 503 likelihood. + +The following example sets the delay to 5 seconds: + +```xml + + + + + +``` + ## Proxy configuration uses HTTP protocol and a pairing token *Only applies to out-of-process hosting.*