DNS Performance: Optimizing Resolution Speed
How DNS Affects Loading Speed
Every HTTP request begins with DNS resolution — converting a domain name to an IP address. This process takes 20 to 120ms, and for the first visit to a domain, up to 200-300ms. On a page with resources from 10 different domains, DNS Lookup can add 1-2 seconds to load time.
DNS resolution is an often-overlooked performance factor that can be optimized without code changes.
How DNS Resolution Works
- Browser checks its DNS cache
- If not found — request to the OS (hosts file, system cache)
- OS queries the recursive resolver (usually ISP or public DNS)
- Resolver traverses the chain: root → TLD → authoritative DNS server
- The obtained IP address is cached at each level according to TTL
Use DNS Lookup on Enterno.io to check DNS records and resolution time for your domain.
Choosing a DNS Provider
Authoritative DNS server speed directly affects first-visit time. Public DNS providers with anycast networks deliver 5-20ms response times from anywhere in the world.
Selection Criteria
- Anycast network — servers in multiple Points of Presence (PoP) worldwide
- Response time — under 30ms from your key audience regions
- Uptime — 100% SLA (DNS downtime = complete site unavailability)
- DNSSEC support — protection against DNS spoofing
- Modern record type support — CAA, TLSA, SVCB
Popular DNS Providers
- Cloudflare DNS — free, fast, 300+ PoPs
- AWS Route 53 — flexible routing, latency-based routing
- Google Cloud DNS — 100% SLA, global anycast network
Optimizing TTL
TTL (Time To Live) determines how long a DNS record is cached. The right TTL is a balance between performance and flexibility.
TTL Recommendations
- Stable records (MX, TXT, SPF) — 3600-86400 seconds (1 hour to 1 day)
- Main A/AAAA record — 300-3600 seconds (5 min to 1 hour)
- Before migration — lower to 60-300 seconds 24-48 hours ahead
- After migration — restore normal TTL after 24-48 hours
Too-low TTL (under 60 seconds) increases DNS server load and slows resolution. Too-high TTL (over 86400) makes urgent changes difficult.
DNS Prefetch
DNS Prefetch is a mechanism for pre-resolving domains from which page resources are loaded:
<link rel="dns-prefetch" href="//cdn.example.com"> <link rel="dns-prefetch" href="//fonts.googleapis.com"> <link rel="dns-prefetch" href="//analytics.google.com">
The browser performs DNS lookups in advance while parsing HTML. When the resource is needed, the IP address is already cached.
Preconnect — Going Further
For critical resources, use preconnect — it performs DNS + TCP + TLS handshake in advance:
<link rel="preconnect" href="https://cdn.example.com" crossorigin>
Use preconnect for the 2-3 most important external domains. For the rest, use dns-prefetch.
Minimizing DNS Lookups
Reduce the Number of Domains
Each unique domain requires a separate DNS lookup. Reduce external domains:
- Host static assets on your main domain or a single CDN domain
- Reduce third-party scripts (analytics, widgets, ad networks)
- Use self-hosted fonts instead of Google Fonts
Domain Sharding — An Outdated Technique
In the HTTP/1.1 era, resources were spread across multiple domains for parallel downloads. With HTTP/2, this is an anti-pattern — multiplexing allows everything through one connection. Extra domains only add DNS lookups.
DNS Monitoring
DNS issues often go unnoticed because the site "works" for most users (their DNS cache is still valid).
- Monitor DNS resolution time from different geographic locations
- Set up alerts for increased DNS lookup times
- Use Enterno.io DNS Lookup for regular DNS record checks
- Set up uptime monitoring — it will detect DNS issues if they cause unavailability
Summary
DNS optimization is low-hanging fruit that requires no code changes. Choose a fast DNS provider with anycast, set proper TTLs, use dns-prefetch and preconnect for external domains, and minimize the number of unique domains on the page. These measures can save 100-500ms on every page load.
Check your website right now
Check now →