How DNS Resolution Stacks Up
getaddrinfo() (or whatever your language runtime wraps around it), the request hits the stub resolver — a minimal DNS client built into the OS. On most Linux systems, this is part of glibc (or musl in Alpine-based containers). The stub resolver reads /etc/resolv.conf, picks a nameserver, sends a UDP packet, and waits.
That nameserver is typically a recursive resolver — something like your cloud provider's internal resolver, or a local instance of Unbound, BIND, or CoreDNS. The recursive resolver checks its cache. On a cache miss, it walks the DNS hierarchy: root servers, TLD servers, authoritative servers. Each step is a separate UDP round-trip.
So a single application DNS query can fan out into multiple upstream queries at the recursive resolver level. This is normal and fast when everything works. The problem starts when something slows down or fails at any point in this chain.
Where Retries Multiply
resolv.conf, it tries the first, waits, tries the second, waits, then cycles back. The exact behavior depends on the timeout and attempts options in resolv.conf, but the point is: one application query that gets no answer can generate several DNS packets at the stub level before giving up.
Now zoom out. Your application is not making one query. A single HTTP request from a microservice might need to resolve the database hostname, the cache hostname, a downstream API endpoint, and maybe an auth service. Each of those is a separate DNS query. And you probably have hundreds or thousands of instances of that microservice.
Here is where the multiplication gets dangerous. Consider three layers where retries happen independently:
- Application/SDK layer. Many HTTP client libraries and service discovery SDKs have their own retry logic on connection failure. DNS resolution failure counts as a connection failure. The SDK retries the whole request, which triggers a fresh DNS query.
-
Stub resolver layer. Each DNS query from the SDK gets retried by the OS stub resolver according to
resolv.confsettings. - Recursive resolver layer. The recursive resolver, on a cache miss or upstream timeout, retries its own queries to upstream authoritative servers.
The Feedback Loop That Makes It Worse
Why Default Retry Settings Make This Likely
BASH
cat /etc/resolv.confTEXT
nameserver 10.0.0.2
nameserver 10.0.0.3
options timeout:5 attempts:2timeout value (in seconds) and attempts count control how aggressively the stub resolver retries. Lower values mean faster failover but more packets during an outage. Higher values mean slower failover but less amplification. There is no free lunch here.
At the SDK level, the defaults vary widely. Some HTTP client libraries retry immediately on connection failure with no backoff at all. Some retry a fixed number of times with a fixed delay. Few ship with jitter enabled by default. You need to check the documentation for whatever libraries your services use — the defaults are often more aggressive than you expect.
Breaking the Loop With Backoff and Jitter
- Retry 1: random between 0 and 2 seconds
- Retry 2: random between 0 and 4 seconds
- Retry 3: random between 0 and 8 seconds
- Retry 4: random between 0 and 16 seconds
- Retry 5: random between 0 and 30 seconds (capped)
What to Evaluate in Your Stack
resolv.conf on your containers and VMs. If you are running many microservice instances pointing at the same recursive resolver, consider whether the default timeout and attempts values are appropriate. Reducing attempts to 1 and lowering timeout can reduce amplification, but it also means legitimate transient failures cause faster errors to the application. Trade-off, not a free fix.
SDK and library retry policies. Audit the HTTP clients, gRPC clients, database drivers, and service discovery libraries your services use. Look for: default retry count, whether backoff is enabled, whether jitter is enabled, and whether DNS resolution failures are treated differently from connection failures. Many libraries let you configure a custom retry policy — use it.
Recursive resolver capacity and caching. If your recursive resolver serves thousands of pods, it needs enough capacity to handle burst traffic. Negative caching (caching SERVFAIL responses briefly instead of re-querying immediately) can significantly reduce upstream load during an incident. Check whether your resolver has negative caching enabled and what TTL it uses for failed queries.
Local DNS caching. Running a lightweight caching resolver (like a dnsmasq or nodelocaldns sidecar) on each node reduces the number of queries that reach the central recursive resolver. Cached answers are served locally, so only cache misses generate upstream traffic. This does not eliminate retry amplification, but it reduces the blast radius.
For a deeper look at how recursive resolver failures cascade into microservice connection problems, the article on checking recursive resolvers when microservices fail to connect covers the diagnostic side. And if you want to understand how retry storms specifically worsen DNS timeouts through feedback loops, this piece on retry storm feedback loops walks through the cascading timeout mechanics.
The Practical Takeaway
resolv.conf, and make sure your recursive resolver has enough headroom and negative caching to survive the burst that comes when something upstream hiccups for two seconds.