What is DNS Time to Live (TTL)? Purpose & Optimizing TTL Uptime
What is TTL?
A DNS record’s Time To Live, or TTL for short, is its kind of expiration date. The TTL instructs the local resolver or recursive server how long to hold the record in its cache. The resolver keeps the information in its cache for a longer period of time the greater the TTL. The resolver keeps the information in its cache for a shorter period of time the shorter the TTL.
TTL is the amount of time or “hops” that a packet is allowed to exist within a network before being discarded by a router. TTL is also used in other contexts, such as CDN and DNS caching.
Time to live (TTL) indicates how long your records are cached. For example, how long will your A record be cached before retrieving a new copy of the record from DNS servers? The DNS cache stores records, and the act of storing records is known as caching.
When a caching (recursive) nameserver requests a resource record from the authoritative nameserver, it caches that record for the time (in seconds) specified by the TTL. If a stub resolver queries the caching nameserver for the same record before the TTL expires, the caching server will simply return the previously cached resource record rather than requesting it again from the authoritative nameserver. TTL for NXDOMAIN responses is determined by subtracting the MINIMUM field of the SOA record from the TTL of the SOA itself, and it specifies how long a resolver may cache the negative response.
Shorter TTLs can put more strain on an authoritative nameserver, but they can be useful when changing the address of critical services like Web servers or MX records, and are thus frequently lowered by the DNS administrator prior to a service being moved to minimize disruptions.
The units of measurement are seconds. An older common DNS TTL value was 86400 seconds, or 24 hours. With a TTL of 86400, if a DNS record on the authoritative nameserver is changed, DNS servers all over the world may still be showing the old value from their cache for up to 24 hours after the change.
You could also change the default TTL for any additional DNS records you add to something other than 3600 seconds (1 Hour). You can access this option by going to your DNS setting panel account’s profile settings.
Why TTL is important for you?
Most of the time, you won’t need to change your TTL. The default TTL of 3600 (1 hour) is sufficient for changes to propagate quickly, but not so low that DNS servers become overburdened. TTL becomes critical, however, if you have a service over your A/AAAA records that dynamically updates the endpoint’s values, such as Dynamic DNS and/or DNS Failover. In this case, you should definitely think about setting a lower TTL value for those specific records of yours.