Manage domain

Buy domain




CloudfloorDNS Knowledgebase

home ->

White papers

Search the knowledgebase  
 

 

Article ID : # Last review : 2009-10-27 00:00:00
#5431

DNS Time to Lives (or TTLs)

 

DNS Time to Live's (or TTL's)

Setting the TTL inappropriately for your domain can have significant side effects in terms of dns traffic and web site performance.

This document is intended to suggest reasonable TTL's (time to live's) and give some information on best practices for your domains.

Why is the TTL important?
The 'time to live' of a dns record specifies the amount of time other dns servers can cache your IP address before checking with us to see if it has changed again. DNS servers at users ISP's generally provide a lookup service that is more local to the user, and hence generally faster to respond. The use of caching enables other users of the ISP that lookup the same record to retrieve the information directly from a very close source generally at a much greater speed. If there was no cache, every single time a web site URL was requested a dns query would need to be made to the servers that run dns for that domain. This can only take 20-50 milli seconds or so, but bear in mind a page may refer to a url lots of times on a page resulting in multiple dns lookups. On many sites as many as 20-30 times a page. Having a local cache prevents repeat lookups for information that is unlikely to have changed. If your TTL is set at 1 hour, the local ISP can cache that record locally and provide the information to other users from it's local cache. Users PC's also cache the information right on their own desktop meaning even faster access after that initial lookup.

The downside of a long ttl
The downside of having a TTL set at 24-48 hours as most larger ISP's and web hosts do is that if you do have to make a change to your domains dns it can take up to the TTL to fully propagate around the world. This means that with your TTL set at 24 hours, some ISP's could still be serving the old information 23 or so hours later. This is worst case, but you can see that it would be important to have both the old and new IP addresses both answering queries for the domain for some time to prevent some users being unable to access them.

The benefit's or a short TTL
If your TTL is short it should be cached for a shorter duration by other internet systems. This means that should an IP address change as a result of a server move or network re-configuration, users pick up on that change and things start working again more quickly.

Finding a balance
The answer is to find a reasonable balance between lower TTL in case you need to make a change to your dns, and less dns traffic/better performance experienced with longer TTL's. At first thought it might seem like a good idea to simply reduce all your TTL's to 10 minutes or so, but not only is this incredibly wasteful of internet resources it can cause performance issues for your web site possibly affecting sales and search engine rankings. Studies have shown that even small delays you would think barely susceptible to humans can make a difference when a user is making an opinion about your web site. In the event of an issue with your dns service, it also means your web site goes off-line faster. Some adsl routers struggle and even become unstable with sub 60 second TTL's, so if your intended web site visitor is a home shopper, bear in mind if their router crashes when surfing your site, they are unlikely to buy!

Some dns records rarely if ever change. Mail servers and name servers are prime examples. It makes good sense to set these records at 24 hours or more. Some registries will even insist on it.

Below are some recommended minimum TTL's for various record types. Set them longer if you can, but no so absurdly long that they take weeks to change if you do change them.

Record type Suggested minimum (in seconds)
A 3600, or 1 hour
MX 86400, or 1 day
NS 86400, or 1 day
CNAME 86400, or 1 day

Note, these are recommended minimums. If you can set your TTL longer, then do so. It will improve your sites performance globally for many users and reduce the load on worldwide dns infrastructure. As of 2009, the dns infrastructure of many ISP's is overloaded. This has been mostly caused by the social networking phenomenon that has erupted over the last few years. Some organizations such as the department of defense have even blocked these sites completely to preserve resources. A single myspace page can have 100 or more dns lookups. Some larger ISP's have reported 10% of the dns capacity taken by myspace alone. Many ISP's have struggled to maintain high performance dns lookup service with this rapid increase in dns traffic. Setting your TTL's longer will help avoid performance issues for users accessing your sites. Setting your TTL's lower than 3 minutes for an 'www' record for example is pointless. Internet explorer will internally cache a dns lookup for 30 minutes, and Firefox for 3 minutes. These 2 browsers account for the vast majority of all web browsers. New visitors will of course get the new dns record quicker, but people surfing your site at the moment it changes will probably not.

Make use of the dns traffic graphs on Microtech's web site if you are using Microtech's dns services to see the affects of changing your TTL's. If the traffic shows no real difference, then live with the benefits of a reduced TTL perhaps. If your dns traffic shows a dramatic reduction, seriously consider keeping the longer TTL to improve performance.

Preparing for a move.
What if one of your servers is moving or you have a change in supplier and need to change an IP address? The best way to go about this is to reduce the TTL on the records you want to change before the planned move. If your TTL is normally 24 hours, consider reducing it to 10 minutes a day before the move. This should mean that when you change your record it will be almost immediate. Once changed you can restore the TTL to the original setting. The below graph is a real-world example of a popular domain that changed the www record to 10 minutes rather than the usual 1 hour for an ip change. The change has a dramatic affect on dns traffic as you can see, so don't forget to increase the TTL again later!

dns query usage graph.  Light blue line at top is total number of queries per day

Not all ISP's allow you this sort of granular dns access or reporting. Microtech's DNS service gives you full control over individual DNS records TTL's and provides very detailed reporting on dns usage enabling you to performance tune your domains dns.

   
 

So that we can improve our search results, please let us know, did this help you? YES | NO

Please note that all articles are the property of Microtech Limited and must not be re-produced without express written permission

#5441

DNS time to Lives (or TTLs)

 

DNS Time to Live's (or TTL's)

Setting the TTL inappropriately for your domain can have significant side effects in terms of dns traffic and web site performance.

This document is intended to suggest reasonable TTL's (time to live's) and give some information on best practices for your domains.

Why is the TTL important?
The 'time to live' of a dns record specifies the amount of time other dns servers can cache your IP address before checking with us to see if it has changed again. DNS servers at users ISP's generally provide a lookup service that is more local to the user, and hence generally faster to respond. The use of caching enables other users of the ISP that lookup the same record to retrieve the information directly from a very close source generally at a much greater speed. If there was no cache, every single time a web site URL was requested a dns query would need to be made to the servers that run dns for that domain. This can only take 20-50 milli seconds or so, but bear in mind a page may refer to a url lots of times on a page resulting in multiple dns lookups. On many sites as many as 20-30 times a page. Having a local cache prevents repeat lookups for information that is unlikely to have changed. If your TTL is set at 1 hour, the local ISP can cache that record locally and provide the information to other users from it's local cache. Users PC's also cache the information right on their own desktop meaning even faster access after that initial lookup.

The downside of a long ttl
The downside of having a TTL set at 24-48 hours as most larger ISP's and web hosts do is that if you do have to make a change to your domains dns it can take up to the TTL to fully propagate around the world. This means that with your TTL set at 24 hours, some ISP's could still be serving the old information 23 or so hours later. This is worst case, but you can see that it would be important to have both the old and new IP addresses both answering queries for the domain for some time to prevent some users being unable to access them.

The benefit's or a short TTL
If your TTL is short it should be cached for a shorter duration by other internet systems. This means that should an IP address change as a result of a server move or network re-configuration, users pick up on that change and things start working again more quickly.

Finding a balance
The answer is to find a reasonable balance between lower TTL in case you need to make a change to your dns, and less dns traffic/better performance experienced with longer TTL's. At first thought it might seem like a good idea to simply reduce all your TTL's to 10 minutes or so, but not only is this incredibly wasteful of internet resources it can cause performance issues for your web site possibly affecting sales and search engine rankings. Studies have shown that even small delays you would think barely susceptible to humans can make a difference when a user is making an opinion about your web site. In the event of an issue with your dns service, it also means your web site goes off-line faster. Some adsl routers struggle and even become unstable with sub 60 second TTL's, so if your intended web site visitor is a home shopper, bear in mind if their router crashes when surfing your site, they are unlikely to buy!

Some dns records rarely if ever change. Mail servers and name servers are prime examples. It makes good sense to set these records at 24 hours or more. Some registries will even insist on it.

Below are some recommended minimum TTL's for various record types. Set them longer if you can, but no so absurdly long that they take weeks to change if you do change them.

Record type Suggested minimum (in seconds)
A 3600, or 1 hour
MX 86400, or 1 day
NS 86400, or 1 day
CNAME 86400, or 1 day

Note, these are recommended minimums. If you can set your TTL longer, then do so. It will improve your sites performance globally for many users and reduce the load on worldwide dns infrastructure. As of 2009, the dns infrastructure of many ISP's is overloaded. This has been mostly caused by the social networking phenomenon that has erupted over the last few years. Some organizations such as the department of defense have even blocked these sites completely to preserve resources. A single myspace page can have 100 or more dns lookups. Some larger ISP's have reported 10% of the dns capacity taken by myspace alone. Many ISP's have struggled to maintain high performance dns lookup service with this rapid increase in dns traffic. Setting your TTL's longer will help avoid performance issues for users accessing your sites. Setting your TTL's lower than 3 minutes for an 'www' record for example is pointless. Internet explorer will internally cache a dns lookup for 30 minutes, and Firefox for 3 minutes. These 2 browsers account for the vast majority of all web browsers. New visitors will of course get the new dns record quicker, but people surfing your site at the moment it changes will probably not.

Make use of the dns traffic graphs on Microtech's web site if you are using Microtech's dns services to see the affects of changing your TTL's. If the traffic shows no real difference, then live with the benefits of a reduced TTL perhaps. If your dns traffic shows a dramatic reduction, seriously consider keeping the longer TTL to improve performance.

Preparing for a move.
What if one of your servers is moving or you have a change in supplier and need to change an IP address? The best way to go about this is to reduce the TTL on the records you want to change before the planned move. If your TTL is normally 24 hours, consider reducing it to 10 minutes a day before the move. This should mean that when you change your record it will be almost immediate. Once changed you can restore the TTL to the original setting. The below graph is a real-world example of a popular domain that changed the www record to 10 minutes rather than the usual 1 hour for an ip change. The change has a dramatic affect on dns traffic as you can see, so don't forget to increase the TTL again later!

dns query usage graph.  Light blue line at top is total number of queries per day

Not all ISP's allow you this sort of granular dns access or reporting. Microtech's DNS service gives you full control over individual DNS records TTL's and provides very detailed reporting on dns usage enabling you to performance tune your domains dns.

   
 

So that we can improve our search results, please let us know, did this help you? YES | NO

Please note that all articles are the property of Microtech Limited and must not be re-produced without express written permission


Subscribe to kb news feed