Advanced Cookie-based session affinity with Application Request Routing (ARR)
Posted: (EET/GMT+2)
One of the great benefits of cloud-based services is that they are built for easy scaling. In Microsoft Azure, scaling up web applications (such as ASP.NET) can be done easily by assigning multiple servers to handle the load.
By default, each request goes to a different server every time, in round-robin fashion. While this is great for many situations, sometimes this might cause problems with things like session management to caching. Luckily, Azure supports something called Application Request Routing (ARR), which can be used to "tie" a particular browser or client to a single server for each request.
ARR allows you to do this based on cookie values. For instance, while inspecting HTTP response headers from a scaled-up (more than one server) web application, you might see something like this:
Set-Cookie: ARRAffinity=1234567abcdef...;Path=/;Domain=myapp.azurewebsites.net
Here, the Azure ARR functionality set the special cookie called "ARRAffinity" which is used to indicate a single server, i.e. the affinity. There's a nice blog post giving more details about ARR on Azure.
Remember, you can also install ARR as a module to your local, on-premises IIS farm or cluster.