What is TTL or Time to Live and what TTL to set for DNS records? What is TTL or Time to Li...

What is TTL or Time to Live and what TTL to set for DNS records?

DNS   DEREK MANNING   1 COMMENTS

Time to live (TTL) is one basic element of DNS records. It is the period of time in computer and computer networking technology that a unit of data such as a packet experiences before it should be discarded. TTL tells local resolving name servers how long a record should be stored locally before it queries the authoritative name servers again for a new record. The record storage is what we can DNS cache and the act of storing the record and not making new queries is caching.

TTL trivia

1. TTL is an indispensable part of Domain Name System.
2. Each DNS resource record has a TTL and it is set by the domain owners on authoritative name servers.
3. TTLs can be used to take advantage of DNS caching. The higher the TTL is, the longer the record information will be stored and the fewer queries the local resolving server needs to make to find the domain name's record.
4. Long TTL can speed up domain name resolving because the record is stored in the cache. Short TTL can minimize disruptions during service migration.

How does DNS (Domain Name System) work?

DNS is a service that converts easy-to-remember domain names to numerical IP addresses which are used to locate computers and devices over the internet. This conversion happens when a user types in a URL in the browser.

Domain names owners set up DNS records and TTL in the authoritative DNS server. If your domain name uses Dynu name servers, then Dynu name servers will be the authoritative DNS server for your domain name. When end users visit a URL, the middleman recursive server fetches domain information from the authoritative server, save that information locally in its memory and then pass it to the end user.

If the TTL for a record is set to 1800 seconds (30 minutes) and the user accesses the URL a second time within 30 minutes, the recursive server will not query the authoritative server again for the record. It would retrieve that information from its local cache instead. This speeds up the DNS resolution process and reduces loads on authoritative name servers all over the world.
How DNS works The short and long of TTL

So what TTL should be set for common DNS record types such as A/AAAA record, CNAME record, MX record and TXT record etc.? It depends on the usage of the DNS record and update frequency.

To start with, if your website is hosted on a server that does not change IP for months, a longer TTL between an hour to 12 hours is acceptable. It would result in fewer lookups and better, more stable performance. If you use our dynamic DNS service or DNS failover service, you will need a shorter TTL between 1 minute and 10 minutes. Because the IP address of your domain name changes frequently in the case of dynamic DNS and may need to be prepared for the change in the case of DNS failover.

As for CNAME, MX, TXT and other records, they rarely change once they are set up. You can start with a shorter TTL during testing phases, and change to a TTL between 12 hours to 24 hours once the records are unlikely to change. The benefits of caching outweigh the need for a faster propagation time once the records are tested to be working and are unlikely to change.

Before a service change such as moving a website to a different IP or changing mail server, the TTL should be set to a shorter one to propagate the change more quickly around the globe.

In the end, keep in mind that TTL is all about getting a reasonable balance between a fast propagation time and taking advantage of DNS caching. If you need any assistance, please feel free to contact us.





Billy Brackett
September 5, 2017 AT 6:38 PM

Great article on TTL and how to take advantage of DNS cache and propagation using TTL. Thank you for sharing.

Reply



*
* (Your email address will not be published.)