TTL – Time to live is a value that signifies how long should the data be kept before discarding. It is commonly used in computers. In the Domain Name System, it has a value in seconds (86 400 for a day, 43 200 for 12 hours and so on) that shows for how long, should a record be kept locally, before you need to make a new query to get this information. The TTL is set separately for the different records. They are set in the authoritative DNS server and the recursive DNS will keep the information depending on the predetermined time. This process of temporary having the record is called caching and the temporary stored data – DNS cache.
How to check the TTL using Windows OS?
You will need to open the Command Prompt as an administrator. From there, you need to use the nlookup. Write this on the command line “nslookup -type=soa www.cloudns.net”. You will get an answer from the authoritative server with the TTL.
You can change the type of the record and look it up for A, AAAA, MX or another type.
How to check the TTL using Linux OS and Mac OS?
You will need to use the dig command.
“dig a cloudns.net” This will give you a long answer. If you want just the TTL, you can try dig +nocmd +noall +answer +ttlid a www.cloudns.net
You can check the different DNS records by changing the text on the last before the domain. For example for AAAA records it will be: dig +nocmd +noall +answer +ttlid aaaa www.cloudns.net and for the MX it will be: dig +nocmd +noall +answer +ttlid mx www.cloudns.net
The previous answers are provided by the recursive servers. If you want to ask directly an authoritative nameserver you should add “+trace” after the “dig” and it will look like this: dig +trace +nocmd +noall +answer +ttlid aaaa www.cloudns.netTTL for different DNS records
- If you want to setup different TTL for every single record you can use our Anycast DNS network!
Shorter or longer TTL?
Many clients prefer to set the TTL to a long period like 2 days (172 800 seconds). This will reduce the load on the DNS servers, because the queries need to be done less frequently. This can be good if you have a very limited DNS plan, but your clients won’t be happy about it. Make your clients’ experience better, with lower TTL and frequently updated records. Shorter TTL is useful if you have a very dynamic environment.
A and AAAA records. You can set it as low as 60 seconds if you really need your clients to get the latest update, but we recommend to have it around 1-2 hours to reduce the load on the servers. You can put it as long as 12 hours or a whole day.
CNAME record. If you need to deliver a lot of content to different parts, you can lower the TTL but in normal conditions you can leave it to 12 hours
MX record. System that have a static IP (it doesn’t change) can put 1800 seconds or more, but the rest with dynamic IP must keep the TTL low.
TXT record. This one you don’t change a lot, so you can set it up to 12hours.
You can experiment with the TTL to see which suits you best. Remember the lower it is, the more often the recursive servers will update the information which is good for your clients. But this will signify a bigger load on your servers and more queries. You should see the results and think if you want to move to a lower or to a higher DNS plan.