DNS TTL and Propagation: Impact on CDN Performance

· Alex Petrov · 9 min read

DNS Time to Live (TTL) is the single most consequential DNS setting for CDN operations. It controls how long recursive resolvers and client machines cache DNS responses before requesting fresh answers from the authoritative nameserver. Setting this value too high locks users into stale routing decisions during failovers. Setting it too low floods authoritative nameservers with unnecessary queries and adds latency to the first request in every TTL window.

For organizations operating content delivery networks, DNS TTL is not merely a DNS configuration detail. It is a performance and reliability lever that directly affects failover speed, traffic distribution responsiveness, and the overhead cost of every user's first page load. This guide examines how TTL works in CDN contexts, what values to use, and how to manage the propagation process during migrations and incidents.

How Does DNS TTL Work in CDN Architectures?

When a user's browser resolves a CDN hostname like cdn.example.com, the query traverses a chain of DNS servers. The authoritative nameserver for the domain returns an IP address along with a TTL value. Each component in the resolution chain, including recursive resolvers (like Google's 8.8.8.8 or Cloudflare's 1.1.1.1), operating system stub resolvers, and the browser's internal DNS cache, stores this response for the specified TTL duration.

DNS Resolution Flow — How users reach the nearest CDN edgeDNS Resolution Flow — How users reach the nearest CDN edge CDN Request Flow — From Browser to Edge CDN Request Lifecycle Step 1 DNS Lookup Step 2 TCP Connect Step 3 TLS Handshake Step 4 Edge Server Step 5 Cache Check Step 6 Response Cache HIT → 5ms response Cache MISS → Fetch origin 0ms ~50ms (cache hit) ~200ms (cache miss)
Figure 1: DNS Resolution Flow — How users reach the nearest CDN edge

During the TTL window, no new DNS queries are sent for that hostname. The cached IP address is used directly. When the TTL expires, the next request triggers a fresh DNS lookup, which may return a different edge server IP based on current geo-routing decisions, server health, or load balancing algorithms.

CDN providers use DNS as a primary traffic steering mechanism. The CDN's authoritative DNS server evaluates each query's source IP (or EDNS Client Subnet data) and returns the IP of the optimal edge server. The TTL determines how frequently this routing decision can be updated for each user. Understanding the full DNS resolution process is essential for grasping how TTL interacts with CDN routing.

What TTL Values Should You Use for CDN Domains?

Optimal TTL values depend on the DNS record's role in your CDN architecture. The following table provides recommended ranges based on common CDN configurations:

Performance Comparison: Edge vs Origin Processing
Metric Edge Processing Origin Processing Improvement
Latency (p50)8–15 ms120–300 ms15–20x faster
Cache Hit Ratio85–95%N/AReduces origin load
TLS Handshake1–5 ms (nearby PoP)50–150 ms10–30x faster
Bandwidth Cost$0.01–0.04/GB$0.05–0.12/GB3–5x cheaper
Availability99.99% (multi-PoP)99.9% (single DC)10x fewer outages
Record TypePurposeRecommended TTLRationale
CNAME to CDNMaps your domain to CDN edge60-300 secondsAllows CDN to steer traffic while reducing DNS overhead
A/AAAA (CDN edge)Direct edge server IP30-60 secondsEnables rapid failover between PoPs
A/AAAA (origin)Origin server IP300-3600 secondsOrigin IPs change rarely; higher TTL reduces queries
NS recordsNameserver delegation3600-86400 secondsNameservers rarely change; long TTL is safe
TXT (verification)Domain ownership proof3600 secondsInfrequently queried; stability preferred
MX recordsMail routing3600 secondsNot CDN-related; standard mail TTL

Most major CDN providers default to 60-second TTLs for their edge DNS responses. Cloudflare uses 300 seconds for proxied records. AWS CloudFront returns 60-second TTLs for its distribution CNAMEs. Fastly recommends 30-60 seconds for domains behind their CDN.

What Is the Real Cost of Low TTL Values?

Every expired TTL triggers a fresh DNS resolution, which adds latency to the request that causes the re-lookup. The cost manifests in several ways:

Increased DNS query volume: A TTL of 30 seconds means each recursive resolver queries the authoritative server 2,880 times per day per domain, compared to 288 times with a 300-second TTL. For high-traffic sites with millions of users behind thousands of resolvers, this can generate millions of additional DNS queries daily.

Added latency on TTL expiry: A DNS lookup adds 5-100 milliseconds to the request that triggers it. With a 30-second TTL, roughly 3% of all requests (assuming steady traffic) pay this penalty. With a 300-second TTL, only 0.3% of requests incur the DNS overhead. Analyze this tradeoff with CDN performance metrics to find the right balance.

Resolver query limits: Some ISP resolvers throttle query rates from high-volume authoritative servers, which can cause intermittent resolution failures during traffic spikes. Very low TTLs exacerbate this risk.

The Case for Low TTLs

Despite the costs, low TTLs provide critical operational benefits:

Why Is Instant DNS Propagation a Myth?

A common misconception holds that setting a TTL to zero (or very low values) achieves instant propagation of DNS changes worldwide. In practice, several factors prevent truly instant propagation:

Global Traffic Routing — Geographic distribution of CDN nodesGlobal Traffic Routing — Geographic distribution of CDN nodes CDN Global PoP Distribution Global Points of Presence North America Europe Asia-Pacific South America Africa Point of Presence (PoP) 15+ Global Locations
Figure 2: Global Traffic Routing — Geographic distribution of CDN nodes

Resolver minimum TTL enforcement: Many recursive resolvers enforce minimum cache times regardless of the authoritative TTL. Google Public DNS enforces a minimum of 30 seconds. Some ISP resolvers cache for 300 seconds or more. This means your 0-second TTL is effectively 30-300 seconds depending on which resolver the user queries.

Operating system DNS caching: Windows caches DNS responses for up to 300 seconds by default (configurable via the DNS Client service). macOS and Linux also maintain stub resolver caches with their own minimum retention periods.

Browser DNS caching: Chrome caches DNS for 60 seconds. Firefox uses its own DNS cache with similar retention. These browser-level caches are independent of OS and resolver caches, adding another layer of stale DNS persistence.

Caching chain multiplication: A DNS change must propagate through the authoritative server, each recursive resolver that has cached the old record, the OS stub resolver, and the browser cache. Even if each layer respects the TTL, the worst-case propagation time is the previous TTL value (not the new one), because resolvers cached the old record with the old TTL.

In practice, expect DNS changes to reach 95% of users within one to two times the previous TTL value, plus 30-60 seconds for resolver minimum caching. Full worldwide propagation to 100% of users may take 24-48 hours due to outlier resolvers with non-compliant caching behavior.

What Is DNS Negative Caching and Why Does It Matter?

Negative caching is the often-overlooked counterpart to standard DNS caching. When a DNS query returns an error response, specifically NXDOMAIN (domain does not exist) or SERVFAIL (server failure), recursive resolvers cache that negative result according to the SOA record's minimum TTL field.

This creates a dangerous scenario during CDN configuration changes. If a misconfigured DNS zone momentarily returns NXDOMAIN for your CDN domain, resolvers worldwide will cache that "does not exist" response. Even after you fix the configuration, affected resolvers continue returning the negative cached result until the SOA minimum TTL expires, which is typically 300 to 3600 seconds.

Mitigating Negative Caching Risks

How Should You Manage TTL During CDN Migrations?

CDN migrations, whether switching providers or changing architectures, require careful TTL management to minimize user impact. The following timeline provides a proven migration protocol:

Phase 1: TTL Reduction (48 Hours Before Migration)

Lower the TTL on all affected DNS records to 60 seconds. Wait at least 48 hours, which is the maximum reasonable cache duration of the previous (higher) TTL. This ensures all resolvers worldwide have picked up the shorter TTL before you make the actual change.

This step is critical and often skipped. If your current TTL is 3600 seconds and you change both the TTL and the DNS target simultaneously, some resolvers will cache the old IP for up to 3600 seconds, creating a prolonged split-brain scenario.

Phase 2: DNS Cutover

Change the DNS records to point to the new CDN. With a 60-second TTL, 95% of traffic will shift to the new CDN within 2-5 minutes. Monitor both the old and new CDN during this period. Key metrics to watch include error rates, latency, and cache hit ratios on the new CDN.

Phase 3: Stabilization (24-48 Hours After Migration)

Keep the low TTL in place for 24-48 hours after migration. This provides fast rollback capability: if issues emerge on the new CDN, you can revert the DNS change and traffic will shift back within minutes. Once satisfied with the new CDN's performance, raise the TTL back to your standard operating value.

Phase 4: TTL Restoration

Increase the TTL to your target value (typically 300 seconds for CDN CNAME records). The higher TTL takes effect immediately for new lookups, but existing cached records with the 60-second TTL will expire within 60 seconds and pick up the new, longer TTL on their next resolution.

How Do CDN Providers Handle TTL Internally?

CDN providers manage their own DNS infrastructure with sophisticated TTL strategies that go beyond simple static values. Understanding these internal mechanics helps explain the behavior you observe:

Dynamic TTL adjustment: Some CDN providers reduce TTL values automatically when they detect edge server issues, allowing faster rerouting during incidents. Once the incident resolves, TTLs increase back to normal values. This dynamic behavior is invisible to the domain owner but directly affects how quickly failover occurs.

Anycast DNS: CDN authoritative DNS servers themselves use anycast routing, meaning the DNS query goes to the nearest DNS PoP rather than a single central server. This reduces DNS resolution latency and increases DNS infrastructure resilience, which partially offsets the latency cost of low TTLs.

EDNS Client Subnet (ECS): Modern CDN DNS servers use EDNS Client Subnet information to make routing decisions based on the user's actual location rather than the resolver's location. When ECS is in play, the resolver must cache responses per client subnet prefix, which increases cache fragmentation and makes each cached entry serve a smaller population of users.

What Are Best Practices for DNS TTL in CDN Operations?

Based on operational experience across production CDN deployments, these practices provide the most reliable DNS behavior:

DNS TTL is a deceptively simple setting with profound impact on CDN reliability and performance. The right TTL value is always a tradeoff between routing agility and query efficiency. By understanding how TTL interacts with the full CDN request flow, resolver behavior, and traffic management strategies, CDN operators can tune this critical parameter for optimal delivery under both normal conditions and incident response scenarios.

External References

References & Standards: OWASP CDN Security · RFC 7234