Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Recursive DNS Resolver

Resolve typed domain queries through the DNS hierarchy while controlling cache freshness, dependency failure and miss amplification.

Problem statement

For this exercise, assume a shared recursive DNS resolver accepts A and AAAA queries for normalized fully-qualified names in Internet class IN.

Resolve through the existing DNS hierarchy, return valid address results or authoritative NXDOMAIN/NODATA, follow at most eight CNAME hops without loops, and honor positive and negative cache lifetimes. A lookup that cannot finish returns a temporary failure; a timeout never proves nonexistence.

Do not serve expired answers. Design the request path, cache, lookup state, replicated service and bounded recovery from slow authorities. Authoritative zone authoring, registration, DNSSEC, international-name conversion and new wire protocols are excluded.

Use ordinary DNS transports including TCP fallback for truncated UDP responses. The follow-up examines popular-key expiry during an upstream outage.

What to build

  1. Answer supported typed queries through the existing DNS hierarchy, including bounded CNAME traversal.
  2. Reuse only unexpired positive and authoritative negative results with correct remaining lifetimes.
  3. Return bounded, distinguishable invalid, negative, temporary-failure and overload outcomes without inventing DNS data.

At scale

  • For this exercise, assume 100,000 queries/sec in aggregate with 90% cache hits in the ordinary workload.
  • For this exercise, assume up to 10 million cached keys; eviction may discard reusable entries but never change their meaning.
  • For this exercise, target 50 ms p95 for cache hits and cap each end-to-end lookup at 2 seconds, including retries.