,

Azure Web App Scale Out and ARR Affinity

Avatar de Vinicius

On Azure Web App Scale Options post, you were introduced how to Scale Up and Scale Out your Web Application, but what happen after scale out completion?

In summary, it will add – or remove – a copy of your application and replicated N times, depending how many instances you have choosen

And how the other instances will be accessed?

When you Scale Out your application, a Load Balancer is added in front of your Azure Web App that will distribute the traffic between the many instances your website has.

Single App Service

In a basic configuration, and using a Single App Service, the visitor will try to access your website and it will directly hit the App Service

single azure app service blog vinicius deschamps

Scale Out App Service

As you can see, once you scale out, a Load Balancer will handle the traffic when a visitor access your website, and distribute the traffic to one of the instances of your Azure App Service

scale out azure app service blog vinicius deschamps
scale out azure app service blog vinicius deschamps

Will my user jump from instance to instance?

No, unless your Azure App Service has been changed from defaults choice that is ARR Affinity enabled.

You can check this option by clicking in Configuration (1), and General settings (2), and look for ARR Affinity (3)

azure app service configuration general settings arr affinity on blog vinicius deschamps

ARR Affinity

ARR Affinity assigns a cookie to the user which ensure the same instance will be used until the session has expired.

Is there a way to check ARR Affinity Cookie?

Yes, there are multiple ways in fact

F12 (in any browser)

First of, press F12 in your browser, then click Network

f12 click network blog vinicius deschamps

Now, access your website, you will notice things loading and being populated at the F12 window, click in any item under Name (1), click Cookies (2) and look for ARRAffinity

f12 click website click cookies check arr affinity blog vinicius deschamps

Chrome

Access your website, and click at the Lock item in the address bar (1), then click Cookies (2)

chrome check arr affinity click lock address bar click cookies blog vinicius deschamps

In the Cookies in use dialog, expand your website (1), Cookies (2), then find and click at ARRAffinity (3), and check its Content field

Important: Please note the Content field does not show the entirely value because of the size of the dialog, you might need to click on it and press CTRL+A to select the entire value and paste somewhere else

chrome check arr affinity expand website address expand cookies click arraffinity check content blog vinicius deschamps

How to make the best use of ARRAffinity Cookie?

In possesion of the ARR Affinity Cookie the troubleshoot process will be easier, and allows isolate the problem

Identify the instance your user is connected

First, go to your App Service, and scroll down and look for Advanced Tools (1), then click Go (2)

azure app service development tools advanced tools go blog vinicius deschamps

Advanced Tools will open in a new window, and it looks like the image below, since you have scaled out your environment, you will see Instance: 4 characters and an down arrow, click on it. As you can see it shows all instances of your App Service, in my case 2.

Important: these 4 characters come from the ARR Affinity cookie, so you can use the first characters to identify the instance and choose properly.

azure kudu toolbar blog vinicius deschamps

I choose the first instance in the dropdown menu, and clicked Environment to see all information about that particular instance. Please note the highlighted area under System info where it says Machine name and Instance id

Important: Please note that Instance id and ARR Affinity cookie have the same value

azure kudu environment information instance 1 blog vinicius deschamps
azure kudu environment information instance 2 blog vinicius deschamps

Restarting a single instance

Despite of being a copy of the App Service, sometimes a particular instance is having problems and a restart might be a solution. After determine the Machine name of the instance, you can restart a single instance by following the steps below

On your App Service, click at Diagnose and solve problems (1), at the Search field type restart (2), then click Advanced Application Restart (3)

azure app service diagnose and solve problems blog vinicius deschamps

At the Advanced Application restart, please select the instance you want to restart (1) and press Restart (2)

azure app service diagnose and solve problems advanced application restart blog vinicius deschamps

And that’s it

I hope you liked it, and I’ll see you on my next post.

Avatar de Vinicius

3 respostas para “Azure Web App Scale Out and ARR Affinity”

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *