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

resolver/dns: add RefreshInterval parameter to enable periodic DNS record refresh #8230

Closed
wants to merge 1 commit into from

Conversation

r9deyes
Copy link

@r9deyes r9deyes commented Apr 6, 2025

This pull request introduces a new feature to the DNS resolver by adding a RefreshInterval variable, which defines the rate at which the resolver refreshes its DNS records. The default value is set to 0, disabling the refresh unless configured otherwise.

Key changes include:

  • New RefreshInterval Variable: Allows for periodic DNS record refreshes, with a requirement that the value must be at least MinResolutionInterval.
  • Updated watcher Function: Incorporates a new channel (refreshCh) to handle refresh signals, enabling automatic updates of DNS records alongside resolution requests.
  • Setter Function: A new SetRefreshInterval function is added to allow users to configure the refresh interval while ensuring it meets the minimum requirement.

These enhancements improve the DNS resolver's responsiveness and accuracy in dynamic environments. Notably, similar functionality is available in the gRPC implementation for ASP.NET Core, which also features DNS address caching and refresh mechanisms (see ASP.NET Core gRPC Load Balancing Documentation). This alignment with existing practices enhances consistency across platforms.

RELEASE NOTES:

  • resolver/dns: add RefreshInterval parameter to enable periodic DNS record

…cord refresh

    This enhancement allows the DNS resolver to optionally refresh its records at a specified interval, improving responsiveness in dynamic environments.
Copy link

linux-foundation-easycla bot commented Apr 6, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

Copy link

codecov bot commented Apr 6, 2025

Codecov Report

Attention: Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.

Project coverage is 82.02%. Comparing base (4b5505d) to head (67f32d3).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
internal/resolver/dns/dns_resolver.go 20.00% 3 Missing and 1 partial ⚠️
resolver/dns/dns_resolver.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8230      +/-   ##
==========================================
+ Coverage   81.98%   82.02%   +0.04%     
==========================================
  Files         410      410              
  Lines       40382    40387       +5     
==========================================
+ Hits        33107    33128      +21     
+ Misses       5895     5889       -6     
+ Partials     1380     1370      -10     
Files with missing lines Coverage Δ
resolver/dns/dns_resolver.go 50.00% <0.00%> (-16.67%) ⬇️
internal/resolver/dns/dns_resolver.go 86.98% <20.00%> (-1.36%) ⬇️

... and 23 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arjan-bal arjan-bal self-assigned this Apr 8, 2025
@arjan-bal
Copy link
Contributor

The scenario when new k8s pods are added and the LB policy uses all the addresses (e.g round robin), refreshing the resolved addresses could be useful. I checked the DNS resolver in gRPC Java, but didn't find the ability to do a periodic refresh. Checking with maintainers of other languages if we need consistent behaviour for this.

@arjan-bal
Copy link
Contributor

Hi @r9deyes, after discussing this with other maintainers, I found that not configuring a client side refresh interval intentional. We don't want servers to rely on hard-coded client behavior for their load balancing stability. Updating clients is very slow. There is a discussion about a similar request here: grpc/grpc-java#2514

The general suggestion is to use MAX_CONNECTION_AGE on server-side to force the client to re-resolve. This is the approach of internet-scale load balancing, though it may be less efficient.

serverOpts = append(serverOpts, grpc.KeepaliveParams(keepalive.ServerParameters{
	MaxConnectionAge: 5 * time.Minute,
}))

I'll be closing this PR, but will re-open if there are any questions.

@arjan-bal arjan-bal closed this Apr 9, 2025
@arjan-bal arjan-bal added Status: Won't Fix Type: Feature New features or improvements in behavior labels Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Won't Fix Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants