-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement consistent round robin load balancing strategy #45
Comments
I'm implementing it as a CoreDNS plugin, I've tested it in playground and the records rotate as expected. |
I have come to the conclusion that this functionality is redundant (except maybe in the demo). Basically it is about load balancing per request, which is reliably enabled by the default coreDNS plugin. The implementation of ordering also requires state implementation, which increases the complexity - especially in a scalable environment. More interesting is per session load balancing, which ensures consistent hashing: #849 see current random roundrobin distributionfunc TestRRWeight(t *testing.T){
inputs := []dns.RR{
test.A("one.example.com. 300 IN A 10.0.0.1"),
test.A("two.example.com. 300 IN A 10.0.0.2"),
test.A("three.example.com. 300 IN A 10.0.0.3"),
test.A("four.example.com. 300 IN A 10.0.0.4"),
}
variationsQuantity := map[string]int{}
for i := 0; i < 1000000; i++ {
// function roundRobinShuffle is shuffler in coreDNS loadbalance plugin
roundRobinShuffle(inputs)
// stringify test.A records to format like: "10.0.0.1,10.0.0.2,10.0.0.3,10.0.0.4"
key := getRRkeyFromA(inputs)
variationsQuantity[key]++
}
print(variationsQuantity)
} === RUN TestRRWeight
1. [10.0.0.1,10.0.0.2,10.0.0.3,10.0.0.4]: 41754
2. [10.0.0.1,10.0.0.2,10.0.0.4,10.0.0.3]: 41711
3. [10.0.0.1,10.0.0.3,10.0.0.2,10.0.0.4]: 41858
4. [10.0.0.1,10.0.0.3,10.0.0.4,10.0.0.2]: 41634
5. [10.0.0.1,10.0.0.4,10.0.0.2,10.0.0.3]: 41578
6. [10.0.0.1,10.0.0.4,10.0.0.3,10.0.0.2]: 41481
7. [10.0.0.2,10.0.0.1,10.0.0.3,10.0.0.4]: 42047
8. [10.0.0.2,10.0.0.1,10.0.0.4,10.0.0.3]: 41950
9. [10.0.0.2,10.0.0.3,10.0.0.1,10.0.0.4]: 42030
10. [10.0.0.2,10.0.0.3,10.0.0.4,10.0.0.1]: 41624
11. [10.0.0.2,10.0.0.4,10.0.0.1,10.0.0.3]: 41388
12. [10.0.0.2,10.0.0.4,10.0.0.3,10.0.0.1]: 41958
13. [10.0.0.3,10.0.0.1,10.0.0.2,10.0.0.4]: 41432
14. [10.0.0.3,10.0.0.1,10.0.0.4,10.0.0.2]: 41909
15. [10.0.0.3,10.0.0.2,10.0.0.1,10.0.0.4]: 41978
16. [10.0.0.3,10.0.0.2,10.0.0.4,10.0.0.1]: 41535
17. [10.0.0.3,10.0.0.4,10.0.0.1,10.0.0.2]: 41444
18. [10.0.0.3,10.0.0.4,10.0.0.2,10.0.0.1]: 41515
19. [10.0.0.4,10.0.0.1,10.0.0.2,10.0.0.3]: 41669
20. [10.0.0.4,10.0.0.1,10.0.0.3,10.0.0.2]: 41803
21. [10.0.0.4,10.0.0.2,10.0.0.1,10.0.0.3]: 41556
22. [10.0.0.4,10.0.0.2,10.0.0.3,10.0.0.1]: 41440
23. [10.0.0.4,10.0.0.3,10.0.0.1,10.0.0.2]: 41189
24. [10.0.0.4,10.0.0.3,10.0.0.2,10.0.0.1]: 41517
--- PASS: TestRRWeight (4.08s)
PASS
^^^ results are almost equally distributed |
The default round robin load balancing strategy should be implemented in a way that gives consistent results when resolving a
Gslb
host.Scenario:
Deployment
with a backendService
calledapp
and that backend service exposed with aGslb
resource on all 3 clusters as:When issuing the following command,
curl -v http://app.cloud.example.com
, I would expect the IP's resolved to reflect as follows (if this command was executed 6 times consecutively):As above, the resolved node IP's that ingress traffic will be sent should be evenly "load balanced" between the clusters.
NOTE:
The text was updated successfully, but these errors were encountered: