Tuesday, 28 July 2009

DNS Caching

All records in DNS have a Time to Live (TTL) value. This value dictates 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.

There are many different places where DNS caches exist: on your local computer, with your ISP's recursive DNS servers, and even the root servers at the core of the Domain Name System. These caches reduce the number of queries that need to be resolved by nameservers.

Sometimes the information in DNS changes, but the old information is still stored in the DNS caches at varying levels. When the cached record is different from the newest information in DNS, it is called a caching error.

How do I fix a caching error?

Depending on your operating system, there are different methods of clearing your local DNS cache. Removing all of your stored DNS information is known as cache flushing. Please see the following list for instructions on how to flush your DNS cache in most common operating systems. (Before flushing the DNS cache, clear out your web browser's temporary files and close all browser windows.)


In Windows 98/2000/ME/XP, open a command prompt and type the following to clear the Windows DNS Resolver:

ipconfig /flushdns


In most *nix operating systems (Unix, Linux, FreeBSD, etc.), type the following to restart the nscd daemon:

/etc/rc.d/init.d/nscd restart


In Mac OSX, open a command prompt and type the following to clear the DNS resolver cache:

dscacheutil -flushcache

In older versions, the command is:

lookupd -flushcache

Some records are cached by your ISP's recursive DNS servers, which are servers that do the 'legwork' of lookups on behalf of subscribers. If a caching error occurs at this level, clearing your local cache will not solve the issue, as your ISP will keep returning the old, incorrect records to your queries. If this happens, you will need to wait for the records to expire naturally.

Common TTL Values

The default or recommended value for the DNS record types in our Dynamic DNS and Custom DNS services are:


TTL Value (seconds)

A (Host), Super Dynamic

20 (20 seconds)

A (Host), Dynamic

60 (1 minute)

A (Host), Pseudo-Static

600 (10 minutes)

A (Host), Static

14400 (four hours)

A (Host), Static

21600 (six hours)

AAAA (IPv6), Super Dynamic*


AAAA (IPv6), Dynamic*


AAAA (IPv6), Pseudo-Static*


AAAA (IPv6), Static*


AAAA (IPv6), Static*



43200 (12 hours)


86400 (24 hours)











* indicated record type only available in Custom DNS Expert interface

In the Expert interface, you can modify the TTL value for any record type. If you do change the default TTLs, values lower than 20 have no noticeable impact on propagation time, and TTL values higher than 86400 (twenty four hours) are likewise unnecessary and can lead to problems if the record needs to be changed.

Caching Issues

When a client attempts to access a domain before it exists, a "does not exist" record will be saved. The TTL for these records varies from server to server, but the average TTL is about 2 hours. During this time period, domain name resolution may not be possible.

Why do some records have such high TTLs?

As discussed earlier, the TTL values of records exist to ease the query load on nameservers. Many records, such as MX or CNAME records, are expected to change very rarely, so they are usually given high TTL to prevent unnecessary extra lookups. Other records, such as hosts assigned to dynamic IP addresses, are given very low TTLs, as they are expected to change at a moment's notice. Unnecessarily low TTLs will also slow clients as they will be forced to perform extra DNS queries.

No comments: