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: Add backoff to DNS resolution attempts #2024

Merged

Conversation

murgatroid99
Copy link
Member

This change is to address the increased DNS resolution traffic when using round robin reported in #2023. With this change, any single channel will space out DNS requests based on the configured connection backoff settings.

@@ -119,6 +122,18 @@ class DnsResolver implements Resolver {
details: `Name resolution failed for target ${uriToString(this.target)}`,
metadata: new Metadata(),
};

const backoffOptions: BackoffOptions = {
initialDelay: channelOptions['grpc.initial_reconnect_backoff_ms'],
Copy link
Contributor

Choose a reason for hiding this comment

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

what if the key doesn't exist? is it oK?

Copy link
Member Author

Choose a reason for hiding this comment

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

Then the value will be undefined, so the BackoffTimeout will fall back to the default value, which is 1000 ms.

@murgatroid99 murgatroid99 merged commit 903cce1 into grpc:@grpc/grpc-js@1.5.x Jan 14, 2022
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