Skip to content

c-ares: make qcache_max_ttl configurable#45073

Open
andy-fong wants to merge 2 commits into
envoyproxy:mainfrom
andy-fong:cares-qcache-max-ttl
Open

c-ares: make qcache_max_ttl configurable#45073
andy-fong wants to merge 2 commits into
envoyproxy:mainfrom
andy-fong:cares-qcache-max-ttl

Conversation

@andy-fong
Copy link
Copy Markdown
Contributor

Commit Message: c-ares: make qcache_max_ttl configurable
Additional Description:
expose the qcache_max_ttl setting and share DNSResolver if cares config is the same so the qcache can be shared. runtime guard "envoy.restart_features.shared_cares_dns_resolver" is set to true by default to enable sharing DNSResolver if cares config of the clusters are the same. Set to false to disable this behavior.

AI is used to generate the tests and write some of the comment but I did review and tune/modify all the tests added. All other code are hand written.

Risk Level: Low
Testing: unit test and manual test using tcpdump to verify multiple clusters with the same host (different port) only generate 1 dns lookup most of the time.
Docs Changes: None
Release Notes: Added qcache_max_ttl field to CaresDnsResolverConfig
Platform Specific Features: None
[Optional Runtime guard:] "envoy.restart_features.shared_cares_dns_resolver" is set to true by default to enable sharing DNSResolver if cares config of the clusters are the same. Set to false to disable this behavior.

Signed-off-by: Andy Fong <andy.fong@solo.io>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @markdroth
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #45073 was opened by andy-fong.

see: more, trace.

@andy-fong
Copy link
Copy Markdown
Contributor Author

There are some past issues in the past that are closed as not planned related to this problem I am trying to solve:

While the correct solution is probably to deduplicate the DNS lookups across clusters or add native DNS cache. They are probably too big of an effort. I know DNS cache is available in DFP but does not look like it can be easily applied to the DNS lookup used by DNS clusters. There is also the new Hickory DNS resolver that seems to support caching but it's still new and I have not tried that. This is kind of a middle of the ground approach to reduce the DNS lookup from envoy in a large env. It's not ideal that I put the resolver_map_ under the DNSResolver class but only really c-ares impl uses that but that's the simplest route without a lot of changes. Open to any suggestion.

…tl-main

Signed-off-by: Andy Fong <andy.fong@solo.io>
@kyessenov
Copy link
Copy Markdown
Contributor

cc @yanavlasov

@markdroth
Copy link
Copy Markdown
Contributor

/lgtm api

@tyxia
Copy link
Copy Markdown
Member

tyxia commented May 22, 2026

/assign @yanavlasov

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.

5 participants