warm the curated DNS resolver set so dead resolvers are cooled down
Random picks kept hitting unreachable public resolvers, costing a 2s timeout on ~half of lookups and capping DNS throughput. Warm the default set at startup (same health check used for the community list).
This commit is contained in:
1 parent
171c9b37eb
commit
e668429d1e
1 file changed
+7
-5
+7
-5
@@ -102,12 +102,14 @@ func run() error {
|
|||||||
var resolver *dns.ServerPool
|
var resolver *dns.ServerPool
|
||||||
switch {
|
switch {
|
||||||
case len(dnsServers) == 0:
|
case len(dnsServers) == 0:
|
||||||
// Default: a curated set of reliable public resolvers. Deliberately not
|
// Default: a curated set of reliable public resolvers. Warm it too, so a
|
||||||
// the community list by default: warming thousands of unknown resolvers
|
// resolver that is unreachable from this network is cooled down instead
|
||||||
// at once has been observed to saturate and break the container's own
|
// of costing a timeout on every random pick.
|
||||||
// resolver, taking down the CT log-list fetch.
|
|
||||||
resolver = dns.NewServerPool(dns.CuratedServers())
|
resolver = dns.NewServerPool(dns.CuratedServers())
|
||||||
slog.Info("dns resolvers configured", "count", resolver.Len(), "set", "curated")
|
warmCtx, cancel := context.WithTimeout(ctx, 8*time.Second)
|
||||||
|
healthy := resolver.Warm(warmCtx, "example.com", 16, 64)
|
||||||
|
cancel()
|
||||||
|
slog.Info("dns resolvers configured", "count", resolver.Len(), "healthy", healthy, "set", "curated")
|
||||||
case len(dnsServers) == 1 && dnsServers[0] == "fresh":
|
case len(dnsServers) == 1 && dnsServers[0] == "fresh":
|
||||||
resolver = dns.NewServerPool(append(dns.CuratedServers(), dns.EmbeddedServers()...))
|
resolver = dns.NewServerPool(append(dns.CuratedServers(), dns.EmbeddedServers()...))
|
||||||
warmCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
|
warmCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
|
||||||
|
|||||||
Reference in new issue
Block a user