Azure App Service - ARR Affinity - Auto-scaling - Stateful application

Bertrand Pons 36 Reputation points
2020-06-23T08:59:16.407+00:00

I would like to get details on the behavior of the app with ARR Affinity enabled and autoscaling.

Let's say I deploy a stateful ASP.NET web app on Azure Web App. Therefore I enable ARR Affinity. I configure autoscaling as well.

What happens if ever an instance is put down due to autoscaling. Does ARR Affinity prevent the scale in as long as user session is still active, or is the user session suddenly broken?

Could you please then give pieces of advice on how to configure stateful application in Azure Web App (or something else)?

Thank you!

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,697 questions
0 comments No comments
{count} vote

Accepted answer
  1. ajkuma 21,506 Reputation points Microsoft Employee
    2020-06-23T16:07:25.807+00:00

    *anonymous user* , Welcome to Microsoft Q&A! Thanks for posting a good question.

    Azure WebApps by default have ARR Affinity cookie enabled, this cookie pairs a client request to a specific server. However, Azure Web Apps is a stateless platform and, in an environment, where we are scaling the Website across multiple instances, the ARR Affinity cookie will be bound to a specific server. In case, the server is no longer in rotation, then all the requests corresponding to the ARR Affinity cookie will fail. It’s advisable to avoid the use ARR cookies in a scaled environment where we have multiple instances that serve our application requests. Disabling ARR cookies is a sustainable resolution for issues related to ARR Affinity cookies in scaled environments, where these cookies rely on the relationship with the worker machine they are paired with.

    Also, when we have ARR Affinity cookies enabled, we are truly not utilizing the scaling ability where a requests can get handled by any instance that has the resources to handle the request. Instead, based on ARR Affinity cookie mapping, the requests will always go to only to the server tied to the Affinity cookie.

    If your application is stateful, scaling up would be best, while if your application is stateless, scaling out gives you more flexibility and higher scale potential.

    For more information about “stateful” vs “stateless” applications kindly watch the following video:
    Planning a Scalable End-to-End Multi-Tier Application on Azure App Service.

    Improve scalability in an Azure web application

    3 people found this answer helpful.

0 additional answers

Sort by: Most helpful