System Design AI

DNS: The Follow-Up Questions Interviewers Ask, With Answers

When you bring up DNS in a system-design interview, the conversation rarely stops at "we’ll use it for name resolution." Interviewers probe because DNS touches latency, caching, fault tolerance, and cost—areas that reveal how deeply you understand the stack. They also want to see whether you can translate a simple component into a robust, production-grade service.

A good DNS answer shows you can balance client-side and server-side concerns, reason about traffic volumes, and anticipate failure modes. Below are the typical follow-up questions, ordered from the most common to the hardest, each with a concise candidate response.

1. What is the typical latency of a DNS lookup, and how does caching affect it?

I would say a fresh recursive lookup usually takes around 50-100 ms, depending on the distance to the authoritative server. With client-side caching (TTL of 300 seconds is common) the effective latency drops to a few milliseconds because the resolver can answer from memory. For example, if my service makes 10 K requests per second and each request does a DNS lookup, caching can reduce the total DNS traffic by roughly 99 % and save roughly 500 to 1,000 seconds of cumulative lookup latency per second of traffic.

2. How would you design a DNS cache for a high-traffic service?

I’d put a caching resolver on every host (or node, in Kubernetes) and keep an in-process cache in the client library, both honoring the record’s TTL. Hot names are then answered locally in well under a millisecond, and the shared recursive resolvers behind them absorb the misses. I wouldn’t add a Redis tier: it is a network hop just like the resolver, and caching past the record’s TTL (say 1.2×) breaks failovers that rely on short TTLs.

3. What happens if a DNS server returns a stale record?

Within its TTL a cached record is served as is, so if the address behind a name changes, clients keep connecting to the old one until the TTL runs out; that is why you lower the TTL well before a planned change. Some resolvers also serve an entry past its TTL during an upstream outage (serve-stale), which keeps names resolving but can point at a dead address. A background refresh shortly before expiry keeps hot entries warm, and clients should retry another address when a connection fails.

4. How do you handle DNS failures in a critical path?

I would add a fallback resolver (e.g., secondary DNS provider) and implement exponential backoff with jitter for retries. If both resolvers fail, the service can fall back to a static list of known IPs for essential endpoints, similar to how recursive resolvers ship with a built-in list of root server addresses (root hints). This layered approach reduces the chance of a single DNS outage bringing down the whole system.

5. Can you explain the difference between recursive and iterative DNS queries?

In a recursive query, the resolver takes on the full responsibility of fetching the answer from the root, TLD, and authoritative servers, returning the final record to the client. In an iterative query, the resolver returns a referral to the next server, and the client continues the lookup. Applications and their stub resolvers send recursive queries; it is the recursive resolver that performs the iterative queries to the root, TLD and authoritative servers. Services almost never iterate themselves, since that moves the work and the cache misses onto every client.

6. How would you scale DNS lookups for billions of requests per day?

Assuming 1 billion requests per day translates to about 12 000 lookups per second, I’d distribute the load across multiple resolver instances behind a load balancer. Each resolver would have its own cache and be stateless, allowing horizontal scaling. Using anycast routing for the resolver IPs would also keep latency low by directing queries to the nearest instance.

7. What security concerns arise with DNS, and how do you mitigate them?

DNS spoofing and cache poisoning are the main threats. I would enable DNSSEC validation on the resolver to verify signatures on records, and use DNS over TLS (DoT) or DNS over HTTPS (DoH) to encrypt queries. Additionally, restricting which resolvers the service can use prevents rogue DNS servers from being introduced.

8. How does DNS affect cost, and where can you optimize it?

Every external lookup incurs network egress and resolver usage fees. By caching aggressively—setting TTLs to the maximum reasonable value (often 1 hour for static services)—you can cut the number of external queries dramatically. For a service that makes 5 M lookups per day, a 90 % cache hit rate can reduce external DNS queries to 500 K, saving both bandwidth and resolver costs.

9. What would you change if the DNS provider you rely on has a regional outage?

First, I’d serve the zone from two authoritative DNS providers, listing both providers’ name servers in the domain’s NS records, so resolvers retry the other provider’s servers when one fails. Second, I’d pre-populate a local cache with critical records (e.g., service endpoints) so the system can continue operating with stale but usable data. Finally, I’d monitor DNS latency and error rates, triggering alerts if the primary provider’s error rate exceeds a threshold (e.g., 5 %).

Senior vs. Staff Answers on DNS

A senior-level answer typically covers the basic mechanics, caching strategy, and a few operational safeguards. A staff-level answer goes further: it quantifies traffic, discusses multi-region anycast design, dives into DNSSEC and DoT implementation details, and outlines monitoring and automated remediation pipelines. Staff candidates also talk about trade-offs between consistency and availability when choosing TTLs, and they can justify design choices with concrete cost and latency numbers.

How to practice this

  1. The worked design, Design a DNS Service like Amazon Route 53, is part of Pro ($10/month) and gives a complete diagram and component notes.
  2. Write out the nine follow-up questions on a canvas, then draft concise answers using the candidate voice.
  3. Read your answers aloud, check that each one has a number and a failure mode, then iterate.

Questions people ask

Why do interviewers ask so many DNS follow-up questions?

DNS touches latency, caching, fault tolerance, and security. Follow-up questions let interviewers gauge how deeply you understand these cross-cutting concerns.

What is a reasonable TTL for cached DNS records?

A common default is 300 seconds, but for static services you can safely use up to 1 hour, balancing freshness with reduced query traffic.

How can I reduce DNS-related costs in a large-scale service?

Cache aggressively with a local caching resolver, and set higher TTLs on records you own where failover speed allows. How much that saves depends on how many distinct names you resolve and their TTLs.

What is the difference between recursive and iterative DNS queries?

Recursive queries have the resolver fetch the full answer for the client. Iterative queries return a referral, and the client continues the lookup.