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 build a two-tier cache: an in-memory LRU for the most recent lookups and a distributed cache like Redis for broader sharing across instances. The in-memory layer would have a TTL matching the DNS record’s TTL, and the Redis layer would use a slightly longer TTL (e.g., 1.2 × record TTL) to smooth out spikes. This design keeps lookup latency sub-millisecond for hot entries while avoiding a single point of failure.

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

If a resolver respects the TTL, a stale record should be refreshed before it expires. However, in practice, a server might serve a cached entry past its TTL during an outage. In that case, the client may experience a failed connection until the cache is evicted. To mitigate this, I would implement a background refresh thread that re-queries the authoritative server a few seconds before TTL expiry, ensuring the cache stays fresh.

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. Most client libraries use recursive queries because they hide the complexity, but internal services sometimes use iterative queries to reduce load on the resolver.

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 have a secondary provider configured in the resolver settings for automatic failover. 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. Review the worked DNS design in the System Design AI library to see 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. Use the AI coach to get feedback on clarity, depth, and any missing edge cases, 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, set higher TTLs where possible, and use a local fallback list for critical endpoints. This can cut external queries by 80-90 %.

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.