Use of Azure slots to recycle applications and minimise downtime, not for deploy reasons

42 Views Asked by At

Has anyone used and noted the use of this technique to recycle an application to minimise client impact.

One needs to recycle and azure and need to minimise client impact.

Why not have exactly the same code base in 2 different slots ? Swap the slots, and then the application is effectively recycled. When a swap slot occurs, then the the slots can be stopped/started.

So

  • [from-slot-a]
  • [to-slot-b]
  • both slots have the same version of the code
  • PANIC ? the app needs to be recycled
  • do a az webapp deployment slot swap ...
az webapp deployment slot swap  -g $rg -n $app --slot $a --target-slot $b
  • the code in slot $a gets put into $b,
  • and code in slot $b gets put into slot $a They were swapped ...

BUT, they were not stopped or started ...

BUT, they now that traffic is WHOLLY going through, one or the other the slots, that can be stopped/started independently.

  • So, before the swap, STOP the $a slot with a

az webapp stop --resource-group rg --name app --slot <$a>

Has anyone used this ? Does anyone do this?

AIM : recycle and app, and minimise downtime

1

There are 1 best solutions below

0
Jahnavi On BEST ANSWER

Yes, Slot swapping is a common and an efficient recycling process approach of web apps which is used to minimize the downtime during deployments as detailed in the given MS Doc.

Good way is to stop the app service in the slot being swapped out to prevent active processing of requests during the swap.

PowerShell script for the above process:

$rg = "xxx"
$a = "newslot"
$b = "slotswap"
$app = "jahapps"
az webapp stop --resource-group $rg --name $app --slot $a
az webapp deployment slot swap -g $rg -n $app --slot $a --target-slot $b

Once the swapping is done, again you restart the app slot which you stopped earlier.

az webapp start --resource-group $rg --name $app --slot $a

Output:

enter image description here

Swapping was successfully done, and also shown in the slot's logs under app service >> deployment slots.

enter image description here