Postmortem: How an Innocent DNS TTL Change Caused a Cascading Cache Stampede
Ahead of a regional database failover, we lowered the TTL on a heavily queried internal DNS record from 300 seconds to 5 seconds so clients would converge quickly. Twelve minutes later, unrelated API services started returning 502 errors.
Timeline and Root Cause
- Our worker fleet opened roughly 4,000 short-lived upstream connections per second, each resolving the target hostname because a legacy HTTP client disabled connection pooling.
- With a 5-second TTL and no jitter, thousands of pods expired their local caches in synchronized waves, flooding the cluster's CoreDNS pods and exhausting upstream UDP sockets.
- Conntrack table drops caused CoreDNS timeouts, triggering client retries that amplified traffic by 4x.
Corrective Actions
- Deployed
NodeLocal DNSCacheon every worker node so lookups hit loopback over TCP/UDP before leaving the host. - Enforced a minimum 30-second TTL floor for high-QPS internal records and enabled CoreDNS
prefetchso hot keys refresh asynchronously before expiry. - Fixed the legacy HTTP client to reuse keep-alive transports across requests.