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-xds: Implement ring_hash LB policy #2568

Merged
merged 14 commits into from Sep 13, 2023

Conversation

murgatroid99
Copy link
Member

@murgatroid99 murgatroid99 commented Sep 8, 2023

This implements gRFC A42: xDS Ring Hash LB Policy, with modifications described in gRFC A61 (grpc/proposal#356).

In addition to the changes specified in A42, I had to make the following changes to get ring_hash to work:

  1. The config selector now takes an additional channelId argument, to be hashed in the "CHANNEL_ID" hash policy.
  2. The xxhash-wasm dependency has been added.
  3. The TypeScript dependency has been updated to 4.x, to get access to the Awaited utility type used in the loader code for xxhash-wasm.
  4. ResolvingLoadBalancer, XdsClusterManagerLoadBalancer, and PriorityLoadBalancer now consistently delegate to the child when in a connectivity state other than READY.

Note: Hash generation only works on Node 15+, because that is when support for bigint representations of 64 bit integers from WASM modules was introduced. If the feature is enabled by the environment variable, the library will not work at all on Node 14 and below. For reference, Node 16 is currently the lowest supported LTS version.

Experimental API changes:

  • Added EndpointMap, an implementation of several Map APIs that considers Endpoint equality based on the unordered set of addresses. Not efficient.
  • The ConfigSelector function signature has an additional argument channelId: number, which is randomly generated for each channel, and has a consistent value for the lifetime of the channel. Implementations that don't use it can ignore it.
  • The QueuePicker class has an additional optional argument childPicker: Picker, which the QueuePicker instance will delegate to if provided.

@murgatroid99
Copy link
Member Author

The interop test passed in this run

@murgatroid99 murgatroid99 merged commit f68ceaa into grpc:master Sep 13, 2023
9 of 10 checks passed
murgatroid99 added a commit to grpc/grpc that referenced this pull request Sep 15, 2023
Similar to #34146, this will only run on master for now. This will work
after grpc/grpc-node#2568 is merged.
sergiitk pushed a commit to grpc/psm-interop that referenced this pull request Nov 8, 2023
Similar to #34146, this will only run on master for now. This will work
after grpc/grpc-node#2568 is merged.
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.

None yet

2 participants