Re: Proposal for weighted routing user experience in Cloud Foundry
toggle quoted messageShow quoted text
I put a long comment in the doc, maybe comments are good for short notes. here is the spiel
"The sum of weights must add to 100"
I would say this is where being user friendly ends. If I add reviews-v4 I have to go in and rebalance the whole thing just to figure out how to get to 100.
an alternate solution can be much simpler:
What if you just used a single integer that is relative to the whole cluster. let's call it "base1-lb"
there are two ways to think of this
relative to each other:
In this scenario, v1 gets twice as many requests as v2, and six times as many requests as v3
or in consideration of X requests: (and this is most likely how the code implements it so that it doesn't have to do a lot of math)
This is saying is that for every (total) 10 requests, this is how they distributed.
to add v4
this is still super simple to look at. v1 gets 6x more than v3/v4, still gets 2x more than v2. I don't have to figure out how to "add up to a 100"
and it's not complicated to calculate either. for every 11 requests:
v1 gets 6
v2 gets 3
v3 gets 1
v4 gets 1
Implementation: "Randomized Round Robin" is also super simple [pseudo code follows]
clusterWeight = [v1,v1,v1,v1,v1,v1,v2,v2,v2,v3,v3] //very easy to create based on base1 solution
randomCluster = random(clusterWeight)
int atomicPointer = 0;
for each request:
next = atomicPointer.getAndIncrease();
application = randomCluster[atomicPointer];
and that's it. the router doesn't have to figure out where the next request goes. This is a simple, elegant and easy to understand solution.
On Fri, Jul 13, 2018 at 3:09 PM Shubha Anjur Tupil <sanjurtupil@...> wrote: