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
Make the loadbalancers servers order random #9037
Conversation
Hello @qmloong, Thanks for your contribution! At first glance, we think that the index shouldn't be leveraged to introduce entropy in server selection. Do you want to take care of it, or shall we do it? |
In this way, the user experience is not very good for a large number of traefik to do forward proxy clusters...Especially automated configuration or deployment for traefik.
BTW, what's wrong with doing this? |
The server list is the result of applying the dynamic configuration, so it doesn't affect the configuration itself. What do you mean by "not very good user experience" in that case?
The problem lies in those lines: traefik/pkg/tcp/wrr_load_balancer.go Lines 111 to 117 in d5ff301
The index value |
For instance, we use traefik as the forward proxy for kubelet (1 : 1) as local proxy to access to 3 kube-apiserver instance A, B, C
I had known this issure.. I just ignored the first iteration. But I can fix it if the above scenario is reasonable. |
Computing the random index will also happen on every Traefik instance independently, so the discrepancy is expected, as well as having the list of servers in a different order on each instance.
At this point, we're not sure we're making ourselves clear. So maybe we should add the commit ourselves to the PR so you can understand/see better? Is that ok for you? |
173dff7
to
0599900
Compare
610f904
to
d429028
Compare
d429028
to
510bd2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
763b347
to
d3e0d49
Compare
f29107f
to
f5548b5
Compare
f5548b5
to
a8aab9b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What does this PR do?
Fix the following issue:
TCP/UDP WRR will always pick the first server when setting up.
This may cause load unbalance when
we use traefik as forward tcp proxy and the upper application use tcp keep-alive connection.
This is a classic LB issue, the issue is that the first index servers will receive larger traffic during startup.
For example, I have, 2 clients (C), 3 traefik (T) and 3 upstream server (U).
Clients(1,2) → Traefik(1,2,3) → Upstream Severs)
1: C1 → T1 → U1
2: C2 → T2 → U1
3: C3 → T3 → U1
Motivation
More
Additional Notes
This PR might mitigate #8275.
Co-authored-by: Mathieu Lonjaret mathieu.lonjaret@gmail.com
Co-authored-by: Romain rtribotte@users.noreply.github.com