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

grpc-js: Implement EDS load balancer #1507

Merged
merged 6 commits into from
Jul 23, 2020

Conversation

murgatroid99
Copy link
Member

@murgatroid99 murgatroid99 commented Jul 17, 2020

This is implemented on top of #1489. The changes for this PR are the last 2 commits, and they affect the files load-balancer-eds.ts and load-balancing-config.ts.

Copy link
Contributor

@stanley-cheung stanley-cheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the logic of the big updateChild() function. It started with the information received from the watcher this.latestEdsUpdate.endpoints. And then a series of operation to re-arrange that information to a more of a hierarchy/tree that's being understood by the childBalancer via its .updateAddressList(addressList, childConfig, latestAttributes) call.

There is a separate concern back in the XdsClient class, on what if we add a 2nd watcher on the same EdsServiceName. What if the first watcher already received an update, but now the 2nd watcher should have received the same information, but updateEdsNames method won't be called again. In the core XdsClient class there seems to be some caching done.

this.isWatcherActive = true;
}

this.updateChild();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, but perhaps we can consider adding a comment here describing why there is an extra updateChild() call here, in addition to the one inside watcher.onValidUpdate().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment.

this.xdsClient = attributes.xdsClient;
this.edsServiceName = lbConfig.eds.edsServiceName ?? lbConfig.eds.cluster;

if (!this.isWatcherActive) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, what if this function updateAddressList is called with a different lbConfig.eds.edsServiceName? After the first call, this.isWatcherActive is set to true. Will the 2nd call not get this.xdsClient.addEndpointWatcher() called?

Or maybe I have misunderstood the semantics - maybe edsServiceName won't change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed this behavior to handle the name changing.

@murgatroid99 murgatroid99 merged commit 3ddfd37 into grpc:master Jul 23, 2020
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 this pull request may close these issues.

2 participants