The interview problem
An internal name resolver is flooded with lookups for nonexistent service names. Cache negative answers while keeping newly created services discoverable.
Original practice, not a reported company interview. All scenarios and worked numbers are illustrative. Interview date: not applicable. Sources retrieved September 30, 2026.
1. Scope and assumptions
Assume an upstream recursive resolver and standards-compliant authoritative answers. Distinguish a name that does not exist, a name with no requested record type, and a temporary upstream failure.
2. Worked approach
query → typed cache entry → unexpired answer / coalesced upstream lookup → bounded cache
Key cache entries by the relevant name, class and answer semantics. Preserve the authoritative negative-answer metadata and compute expiration from the applicable negative TTL rules. Treat NXDOMAIN differently from a no-data answer for one record type. Do not convert timeout or SERVFAIL into a permanent nonexistent-name result.
Coalesce simultaneous identical misses and cap per-tenant outstanding lookups. Validate responses through the chosen resolver stack rather than accepting arbitrary unauthenticated payloads. On expiration, refresh with bounded concurrency. Include cache-hit reason and remaining lifetime in diagnostics so operators can distinguish an old negative answer from an authoritative current one.
3. Calculate the example
Suppose a negative answer is cached with 60 seconds remaining and a service is created 10 seconds later. A client reaching that same cache may continue seeing the negative answer for approximately 50 additional seconds, absent an explicit supported invalidation. With 10,000 identical lookups/s, coalescing one upstream request and caching a valid negative answer can avoid nearly 600,000 upstream requests over a minute; requests at boundaries and other caches alter the exact count.
4. Failure cases and trade-offs
A generic error cache that treats transport failure as NXDOMAIN hides healthy services. Unbounded random names defeat hit rates and exhaust memory. Bound entry count, evict safely and rate-limit abusive tenants without poisoning other tenants' resolution.
Long negative lifetimes protect upstream capacity but delay discovery after a missing name becomes valid. Lower TTLs improve that transition at more query cost. Application retry policy should respect resolution behavior rather than hammering a cache every millisecond.
5. Validate the result
Create a name during a cached-negative interval and measure visibility at multiple resolver layers. Test separate record types, upstream timeout and large random-name streams. Verify that fallback does not accidentally bypass the intended private namespace.
6. Interview follow-ups and self-review
Why is no IPv6 record different from no name? Which cache can an application actually invalidate?
Reward error classification, scoped cache keys, TTL arithmetic and bounded miss traffic.
Sources and related practice
Technical reference: www.rfc-editor.org — DNS negative caching semantics; operational scenario and rates are invented.
Exact publication/update date not established in this review. Retrieved September 30, 2026. This reference supports the named technical concept; the proposed workflow and examples are original, not a documented vendor implementation or interview report.
Continue with Design a distributed cache; Route around failing service dependencies.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.