Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Azure load balances scaled out App Service plan?

I have one Azure App Service in which I have created 5 instances using App Service Plan Scale Out option. Now I am not sure how does Azure load balances requests between this instances? I am not seeing any load balancer for it.

Also how can I know that which request is being served by which instance?

like image 451
Rushi Soni Avatar asked Apr 04 '18 12:04

Rushi Soni


People also ask

How does Azure App Service scale out?

The App Service platform will automatically scale out the number of running instances of your application to keep up with the flow of incoming HTTP requests, and automatically scale in your application by reducing the number of running instances when incoming request traffic slows down.

What is scale in App Service plan?

Scale out: Increase the number of VM instances that run your app. You can scale out to as many as 30 instances, depending on your pricing tier. App Service Environments in Isolated tier further increases your scale-out count to 100 instances.

Are Azure App Services load balanced?

In front of every Azure App Service is a load balancer, even if you only run a single instance of your App Service Plan.

When should you scale out your deployment in Azure?

Scaling out will take your application and clone it as many times as necessary, all while adding a load balancer to make sure traffic is spread out evenly. Scaling up is the best approach if you have low traffic activity but are still seeing resources peak to 100%.


1 Answers

The load balancer is created automatically and you can't see it.

Basically it sends the requests to instances at random, though it can be made "sticky" with ARR Affinity. You can find the setting in the App Service's Application Settings:

ARR Affinity toggle in Portal

If it is on, the load balancer will attach a cookie to responses if they don't already have it. It makes it so that future requests hit the same instance. Though of course if the instance is no longer there (because of auto-scale for example), then it will again go to a random instance.

The WEBSITE_INSTANCE_ID environment variable can tell you in the back-end which instance is handling the request. You can find a list of available variables here: https://github.com/projectkudu/kudu/wiki/Azure-runtime-environment

like image 62
juunas Avatar answered Oct 21 '22 22:10

juunas