What is DNS TTL?
The Time to Live (TTL) concept determines the timespan during which the recursive resolver can cache a DNS record. This value directly affects the optimization of the response speed of the DNS records. The reason is that when the recursive resolver has cached the DNS record, a complete DNS lookup process is not necessary anymore.
The TTL Function
When the resolver receives a request to access a domain, it first looks for the DNS records stored in its cache. If the resolver finds a record in the cache, it checks the record Time to Live. And, provided that the record has not expired, the resolver uses it.
However, if the resolver does not find such a record in its cache or the record time to live has expired, then it transfers a request to the root server, then the TDL server, and ... to access the domain.
The TTL Impact on the Propagation Time of a Changed Record
If the recursive resolver caches a DNS, it uses the same record stored on its cache and does not transfer any request to the upstream DNS servers until the record expires. Hence, you should pay close attention to setting the TTL for a DNS record. For example, if you determine a high time to live (for instance, a day) for a constantly changing record, it takes a whole day for the record resolver to receive the new changed record. The timespan required to advertise the DNS server changes is known as the propagation time.
How to Check the DNS Records TTL by the Dig Command
You can apply the dig tool to request all the records from the DNS server and view the time to live for every record on Linux (or UNIX) and Macintosh OS X:
What are the Best Values for Time to Live?
There are different records with various uses in DNS. You need to set the TTL value for a record according to the record function and its changes during short- and long-term periods. However, you can, for example, set the following values for your records:
- A and AAAA Record: A timespan between 5 min. to 1 hour,
- CNAME Record: 24 hours,
- TXT Record: 12 hours,
- MX Record: 12 hours.
How to Configure TTL for DNS Records on the ArvanCloud User Panel
While defining a record on the ArvanCloud user panel > DNS product > Records Management section, you can also determine the record Time to Live value. The ArvanCloud default TTL for records is 2 minutes.
To change the Time to Live for a predefined record, directly click on the Pen icon (Edit option) and set your desired TTL on the open window.