Hi to all:
I would greatly appreciate if you could give me any help or guidance about how the client session affinity works under the hood.
I want to use client session affinity, in a IaaS environment, where you have a loadbalancer (with a weighted round robin algorithm), and some virtual machines (for example 2) behind it that implement the AAR IIS module.
When a request arrives to the Virtual IP Address (VIP) and port 80 (as is configured), of my loadbalancer they are redirect to the Direct IP Address (DIP) and port, of one of the virtual machines in a round robin fashion.
If for the virtual machines I have defined two endpoints (one public to the outside world namedhttp in port 31221 , and another internal to my network namedhttp_SESSION_AFFINITY in port 8080), and I have configure the AAR modules of each virtual machine, with a server farm that includes the DIP and port of each of my virtual machines listening on the internal endpoint (http_SESSION_AFFINITY), and I have establish the folling rewrite rule:
<rule name=”http_SESSION_AFFINITY” stopProcessing=”true”>
<match url=”.*” />
<action type =”Rewrite” url=”http://{0}/{{R:0}}” /> <!-- Where {0} I going to be equal tohttp_SESSION_AFFINITY, and {R:0} is equal to the original_Url receive by the load balancer, (http://myapp.cloudapp.net)¿Is this true? - - >
</rule>
I understand that if I received a request to http://myapp.cloudapp.net:80, that comes through the load balancer VIP, it will be transferred to one of the virtual machines (port 31221) behind the load balancer in a round robin fashion. There it will be evaluated by the above rewrite rule of the AAR module.
My questions are:
- If the rewrite rule is http://http_SESSION_AFFINITY/myapp.cloudapp.net, and the InternalEndpoint (http_SESSION_AFFINITY):8080 by definition is not load-balanced, which instance is going to process this request, the one that received the original request through the loadbalanced InputEndpoint http, that is Instance 1? Or another one?.
- If the first case is true, If the client session affinity that we want to maintain is with the other instance (Instance 2), how does the AAR module transfers the request to the other instance (from Instance 1 to Instance 2)? How does it knows to which instance to send the request?
- How does it work?
- Does each instance knows internally about the value of their own cookie, and the value of the cookies of the other instances and their corresponding DIP, in order to route the request to the DIPn:8080 of the instance to which we want to maintain the client session affinity?
- Or what happens is that each instance, only knows it’s own cookie, and if they receive a request with a cookie that don’t belong to their instance, they just don’t process it and send the request back to the VIP (http://myapp.cloudapp.net), where it will be reprocess by a random (WeightRoundRobin) virtual machine instance.
- Or what happens is that inside the cookie, we have the information about the DIP of the server that we want to access.
I will really appreciate any help or direction from you, on how client session affinity works under the hood.
Many, many thanks in advance for your help.
Best regards.
Ángel