Hash based persistence - how it works
Hi,
I did read every document and discussion about it and still don't get the idea how it works. Probably that is so obvious for pros that nobody cared to explain it in plain English.
What I figured out - but maybe I am wrong is:
-
Hash algorithm is used create - quite a discovery :-) - hash from some value passed to it.
-
For given value hash is always the same
-
Hash persistence is most often used to load balance cache or proxy farms
-
From article "The solution is to intelligently load balance requests and 'persist' them to a specific cache not based on who the client is, but based on the content requested"
And then I am lost how it's in fact working. My wild guess it's something like that:
-
iRule is used to set value that should be used for first hash
-
Hash is calculated for each pool member based on ip:port or name?
-
Hash from point 1 is combined with pool member hash for each pool member creating "score"
-
In case of ratio is assigned to pool members combined hash (score) for given member is multiplied by ratio value
-
Request is sent to member whit highest score
Is above correct?
If so assuming that hash for the same value is always identical and hash for given member is as well constant request for given value will always be directed to the same member because always score will be the same and highest for the same member.
What will happen when given member is down? Second highest score is winning? Then when member is back I assume that it will again be winning because again its score is highest?
I think above will be true as long as both value extracted from request and id of member is the same. When id for member will change persistence will be broken?
Again if all above is more or less correct what values from request are most often usefull for real life implementations? Client IP, User-Agent...
Piotr