We have a number of Azure Web Apps which we deploy to regularly (several times a week). The deploys are performed using the Zip Push Deploy method (https://docs.microsoft.com/en-us/azure/azure-functions/deployment-zip-push), and this works very well.
Our issue is that the different web apps are not properly started until the first requests are issued against the server, which means that the first user gets a large performance penalty. We tried to resolve this by making a request right after the deploy is done, but it seems that we too often hit the old version of the web app instead of warming up the new one.
I know that we could use deployment slots and their warmup-functionality, but for many reasons, deployment slots are not an option for us right now.
Is there any way we can know when a deployment is finished so that we don't trigger a warmup call before the new code is up and running (e.g. user a Powershell script)?
Currently we use a Powershell query similar to the one below to hit the app services, but often they return very quickly due to the fact that the deployment has not yet completed:
# Warmup Azure service
$warmupUrl = "https://$appName.azurewebsites.net/"
Write-Output "Making request to $warmupUrl"
$stopwatch = [Diagnostics.Stopwatch]::StartNew()
Try {
# Allow redirections on the warm up
$response = Invoke-WebRequest -UseBasicParsing $warmupUrl -
MaximumRedirection 10 -TimeoutSec 240
$stopwatch.Stop()
$statusCode = [int]$response.StatusCode
Write-Output "$statusCode Warmed Up Site $TestUrl in
$($stopwatch.ElapsedMilliseconds)s ms"
} catch {
#$_.Exception|format-list -force
} Finally
{
$stopwatch.Stop()
Write-Output "Warmed Up Site $warmupUrl in
$($stopwatch.ElapsedMilliseconds)s ms"
}