What is Time To Live (TTL)

linux anvar

Time to live (TTL) is used for computer data including DNS servers. It is nothing but time on the period of time or number of iterations or transmissions in computer and computer network technology that a unit of data (e.g. a packet) can experience before it should be discarded.

TTL and DNS Caching

TTL value tells local resolving name servers how long a record should be stored locally before a new copy of the record must be retrieved from DNS. The record storage is known as the DNS cache, and the act of storing records is called caching.

  1. TTL is part of the Domain Name System.
  2. TTLs are set by an authoritative nameserver for each resource record.
  3. TTLs are used for caching purpose. For example, www.dnsknowledge.com TTL value is 86400 seconds, which is 24 hours. The higher a record’s TTL, the longer the information will be cached, and the less queries a client will have to make in order to find the domain.
  4. TTLs will be used by the resolving name server to speed up name resolving by caching results locally.

Can I Set Shorter TTLs?

Yes, you can set shorter TTLs. However, it can cause heavier loads on an authoritative nameserver, but can be useful when changing the address of critical services like web servers or MX records (mail server pointers), and therefore are often lowered by the DNS administrator prior to a service being moved, in order to minimize disruptions.

Common TTL Values

Usually TTL value is 86400 seconds, which is 24 hours. This is good starting point for most records. However, you can set higher TTL for MX or CNAME records as they are expected to change very rarely. If your service is critical, it is recommend that you set TTL to 1 hour (3600 seconds).