Time to Live (TTL) indicates the time period that a recursive resolver can keep a DNS record in cache. This parameter has a direct effect on response time of DNS records, because when a recursive resolver has a DNS record in its cache, a complete DNS lookup is no longer required.
TTL functionality
When a resolver receives a request for accessing a domain, it will search its own cache for the DNS records of the domain, first. If a record is found in the cache, it will check its TTL and if it’s not expired, the resolver will use the cached record.
If the record is not found in the cache or is expired, the resolver will send a request to the root server, then to the TLD server, and so on.
The Effect of TTL on Propagation Time of a Modified Record
If a DNS record is cached, the recursive resolver would not send a request to access this record to upstream DNS servers until its expired, and in the meantime it will use the old cached record.
Therefore, the TTL of a DNS record must be chosen carefully. To better understand this, consider a record that is constantly changing and its TTL is set to a large value, for example one day. It will take a whole day for the recursive resolver to request and then receive the new value of the changed record. The time that takes for the changes in DNS records to be propagated to all DNS servers, is called the propagation time.
Checking the TTL of DNS records using dig command
in Unix based operating systems and Mac OS X, you can use dig command to request all DNS records and see their TTL values.
dig +nocmd example.com any +noall +answer
Best values for TTL
There are various DNS records with different uses. The TTL of a record must be determined based on record type, functionality, and its frequency of change in both short-term and long-term. The typical TTL value of some records are presented here:
⦁ A and AAAA records: between 5 minutes to 1 hour
⦁ CNAME records: 24 hours
⦁ TXT records: 12 hours
⦁ MX records: 12 hours
Setting the TTL of DNS records in Arvan Cloud’s panel
You can set the TTL value of a record when you are defining it in the following path: Panel ->CDN -> DNS
In Arvan Cloud, the default value of TTL is set to two minutes.
Also, in order to change the TTL value of a predefined record, you simply need to click on the edit icon in front of the record and set the TTL value in the opened window.