Skip to content
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

Some questions about retry in ewma balancer #6632

Closed
spacewander opened this issue Dec 16, 2020 · 2 comments · Fixed by #6639
Closed

Some questions about retry in ewma balancer #6632

spacewander opened this issue Dec 16, 2020 · 2 comments · Fixed by #6639
Assignees
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@spacewander
Copy link
Contributor

After reading https://github.com/kubernetes/ingress-nginx/blob/master/rootfs/etc/nginx/lua/balancer/ewma.lua. I have some questions:

  1. During retry, the tried endpoints still be counted when picking a new upstream. Will a request hit a bad endpoint which has lowest score twice?
  2. I notice only the first upstream will be counted during retry:
    local response_time = tonumber(split.get_first_value(ngx.var.upstream_response_time)) or 0
    local connect_time = tonumber(split.get_first_value(ngx.var.upstream_connect_time)) or 0
    local rtt = connect_time + response_time
    local upstream = split.get_first_value(ngx.var.upstream_addr)
    Should not we count the latest/last upstream? A tried upstream will be counted multiple times, is this intentional?
@spacewander spacewander added the kind/support Categorizes issue or PR as a support question. label Dec 16, 2020
@aledbf
Copy link
Member

aledbf commented Dec 16, 2020

/assign @ElvinEfendi

@ElvinEfendi
Copy link
Member

@spacewander yes, there's a chance that tried and failed endpoint gets picked again. Yes, it is also an issue that we only count the first one in every retry. Changing that to last one makes sense to me, effectively it means we count every try. It almost feels like the algorithm is designed with the assumption that NGINX prepends every next try to those upstream_ variables (whereas in fact NGINX appends).

Are you interested in sending a patch? I'd be happy to further assist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants