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

Load balance traffic to N>1 server nodes #630

Open
kamran-m opened this issue Jun 16, 2017 · 0 comments · May be fixed by #631
Open

Load balance traffic to N>1 server nodes #630

kamran-m opened this issue Jun 16, 2017 · 0 comments · May be fixed by #631

Comments

@kamran-m
Copy link

Currently the logic of tchannel-go to choose a peer is

for i := 0; i < size; i++ {
	popped := l.peerHeap.popPeer()
	if canChoosePeer(popped.HostPort()) {
		ps = popped
		break
	}
	psPopList = append(psPopList, popped)
}
...

Which means, the client node will only talk to one server node, the top chosen one, unless there is a change in scores. This means that even if we use the HRW scorer there will be a traffic imbalance, specially for cases where the number of client and server nodes are low.

I would like to introduce peerConnectionCount (default=1), so that we can pick the top peerConnectionCount nodes and do a random load balancing among those instead of talking to only one node. This should reduce the imbalance of traffic to server nodes.

In future, I think it's better if the whole logic of score calculator, peer heap and the new peer connection count, move to something like PeerSelectionStrategy, so other strategies would be easily added.

cc @prashantv @Raynos

@kamran-m kamran-m linked a pull request Jun 17, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant