• 8 September 2024

The validity period (Time to Live or TTL) specifies the period that the recursive resolver can maintain a DNS record in its cache. This value directly affects the response speed of DNS records because if the recursive resolver has the DNS record in its cache, there is no need for a complete DNS lookup process.

TTL Function

When the resolver receives a request to access a domain, it first looks for the DNS records of that domain in its cache. If it finds a record, it checks its validity period, and if it has not expired, it uses the same record in its cache.

But if it does not have this record in its cache or the time to live of that record has expired, it sends a request to access that domain to the root server, then the TLD server, etc.

The Effect of TTL on The Release Time of a Changed Record

If the DNS record is cached until its TTL expires, the recursive resolver will not send a request to get that record to the upstream DNS servers and will use the same old record. So care must be taken when setting the time to live for a DNS record. Because for example, if a high TTL like one day is specified for a record constantly changing, a full day must pass for the recursive resolver to receive the new changed record. This period it takes for DNS server changes to be propagated is called propagation time.

Checking The Time to Live of DNS Records with The Dig Command

Using the dig tool on Linux (or Unix) and Macintosh OS X operating systems, you can request all records from the DNS server and view the time to live of each record:

dig +nocmd example.com any +noall +answer

Best Values ​​for Time to Live

In DNS, there are different records with different uses. The time to live of a record should be determined considering each record’s performance type and its changes in short or long-term periods. But for example, you can set these values ​​for records:

  • A and AAAA record: time interval between 5 minutes and 1 hour
  • CNAME record: 24-hour time frame
  • TXT record: 12-hour time frame
  • MX record: 12-hour time frame

Setting TTL of DNS Records in The ArvanCloud User Panel

When defining a record in the ArvanCloud user panel and DNS records section you can specify its TTL. ArvanCloud’s default TTL for records is 2 minutes.

Also, to change the time to live of a predefined record, just click on the edit icon in front of the desired record. In the opened window, set the time to live to your desired value.