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

With default resolver, round robin load balancing doesn't round robin #1783

Closed
robotlovesyou opened this issue Jan 8, 2018 · 2 comments · Fixed by #1785
Closed

With default resolver, round robin load balancing doesn't round robin #1783

robotlovesyou opened this issue Jan 8, 2018 · 2 comments · Fixed by #1785
Assignees

Comments

@robotlovesyou
Copy link

Please answer these questions before submitting your issue.

What version of gRPC are you using?

1.9.0

What version of Go are you using (go version)?

1.9

What operating system (Linux, Windows, …) and version?

Linux

What did you do?

Use the round robin load balancer with multiple IP addresses resolving from a single name.

What did you expect to see?

The client should call the servers in a round robin fashion

What did you see instead?

It just resolves a single server and does not round robin the calls.

In a previous version of GRPC, where the resolver was provided to the balancer explicitly, this was not an issue.


So, this is an experimental API with very little in the way of documentation (at least that I have found) so chances are I've just been doing something stupid but if I simply use the WithBalancerName(roundrobin.Name) dial option then I don't get round robin behaviour from the load balancer. It logs a call to newPicker with a single resolved address and simply calls that.

What does work is if I add a line beforehand
resolver.SetDefaultScheme("dns")

The call to newPicker then gets the expected number of addresses and the round robin balancing works as expected.

I'm not sure what I would suggest to address this but it should at least be a little more obvious that the round_robin balancer won't work with the default resolver? Or, as mentioned before, I'm just doing something odd.

@menghanl
Copy link
Contributor

menghanl commented Jan 8, 2018

The default resolver was changed from "dns" back to "passthrough" in #1606. The reason is that if we change the default resolver behavior, user's tests might be broken.

A "passthrough" resolver doesn't try to resolve the target, and will return the target back directly. The target will eventually be resolved by net.Dial, but there will be no load balancing in this case.

To use the "dns" resolver, please try to add "dns:///" prefix to your target. (The target format is defined in this doc).
resolver.SetDefaultScheme sets the default target scheme. If you are sure you want "dns" to be the default in your program, doing this in an init() would also be a good idea.

Sorry for the missing of documentation. I will add a doc to DialContext to explain how to pick the resolver (#1785).

@robotlovesyou
Copy link
Author

robotlovesyou commented Jan 9, 2018

@menghanl Thanks for pointing me towards the correct documentation. Using the "dns:///" prefix removes the need to call resolver.SetDefaultScheme

@lock lock bot locked as resolved and limited conversation to collaborators Sep 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants