I understand that ARR affinity cookie pairs a client request to a specific server. And if it is enabled, then the requests will always go only to the server tied to the Affinity cookie. Azure Web Apps being a stateless platform this is not always helpful as it does not utilize the capability of scaling out in Azure App Services.
My question is what are the scenarios, where we should and should not enable the ARR affinity cookie?
Being a PaaS environment, I know we do not have much control over the platform as an end user, but when I try to see the data in Azure Application Insights, I could see different cloud role names getting generated on which the instances are currently running. Just curious to know how the Application Request Routing and Load Balancing is happening at the backend in the App Service Environment.
Thank you.
ARR affinity is a good solution for legacy application compatibility as they may not have been designed with load balancing in mind.
while you can set this option to Off for stateless applications. See doc.
Reference: ARR affinity in Azure App service
For how the Application Request Routing and Load Balancing happening, here is a document about App service Architecture might help you to understand.
The front end is a layer seven-load balancer, acting as a proxy, distributing incoming HTTP requests between different applications and their respective Workers. Currently, the App Service load-balancing algorithm is a simple round robin between a set of servers allocated for a given application.