Up to this moment in the „What is а DNS?“ series we learned that the DNS resolver can discover a specific domain’s IP addres by reaching the DNS Index and searching for the important DNS record “domain.name=IP address”.
Once discovered, the DNS record will be copied to the DNS resolver cache. The DNS record will remain in the cache for a certain time period. During this period the DNS resolver will use the stored record to serve data to clients looking for it.
DNS caching enables every DNS server or client to save and store a copy of the DNS record for future use by eliminating the need of performing new DNS lookups in the Index.
After the resolver has once found the authoritative name servers for the .bg TLD they are also saved in the DNS cache. If the DNS resolver needs to look up another .bg domain, e.g. mysupersite.bg, it will start directly from the authoritative name servers of the .bg and TLD will skip sending a query to the root DNS servers.
The time for which the DNS data is considered up-to-date is called Time to Live.
The Time to Live is set up in seconds and is an integral part of each DNS record such as A, MX, CNAME, TXT, NS. For example the important DNS record:
has a TTL of 86.400 seconds or 24 hours.
The record will remain for 24 hours in the cache and if a client requests superhosting.bg’s IP, the DNS resolver will perform a new DNS lookup so as to retrieve an up-do-date copy of the DNS record.
If during the 24-hour period there is a change performed into the DNS record, in the domain DNS zone, the DNS resolver will be able to detect it only after the 24-hour period is over. Until then the resolver will serve the clients the old cached record.
The TTL value might vary from bigger to smaller for example 21600 (6 hours), 14400 (4 hours) or less.
The maximum length of a period for setting up the TTL is 231-1, which is nearly 68 years!
DNS Cache Resolver
The DNS Cache Resolver is an application which can be located on the same server as the DNS resolver. The combination of the two applications is called DNS Cache Resolver.
Theoretically the responsible authoritative name servers and resolvers which send queries to them both are quite sufficient for the proper functioning of the Internet. However, only with the two of them each DNS lookup will need to start from the root DNS servers. As of mid-2017 there are over 330 million registered domain names. If translating them is left only to the resolvers and responsible name servers, this might lead to excessive load and even a crash in the DNS Index.
To improve efficiency, reduce the DNS traffic and increase performance of the applications, DNS cache servers need to be added to the DNS system. They store a copy of the DNS records, received from the DNS lookup for the specific TTL period. The cache is used for every upcoming query for the same data. DNS cache speeds up domain load.
After the DNS domain records are saved in the DNS cache:
( 1 ) Enter the domain name in the browser. The browser then will ask the local DNS client “What is the IP address of this domain” and the DNS client asks the cache resolver of the ISP.
( 2 ) The caching DNS resolver directly answers with the IP domain address without performing a lookup in the Index. The web browser then connects to the website server.
The cached DNS data is obtained only after the DNS resolver has once performed a lookup in the DNS index.
Local DNS Cache
СNormally, your PC’s operating system should have a local DNS resolver (DNS client) with local DNS cache. Therefore, it is possible that the cached DNS data is already available on your computer.
For example, if you are using Windows 10 and you want to see what is happening in your computer’s DNS cache, use the command „ipconfig /displaydns“ through CMD.
Open CMD (Win+R, type cmd, Enter) and then use the command:
To clean the local DNS cache use:
When a website is moved to a new hosting service, the server’s IP address changes so you can reduce the TTL for the domain А record beforehand. This way you will reduce the propagation time for the new DNS details after you change the domain IP address. The TTL change is performed in the current domain DNS zone. For example you can set up a TTL 300 which equals 5 minutes.
It is important to take into account the value before the change and that the new value will take effect after the previously set time is over. Example: The current value is 14400 which equals 4 hours. We can reduce this to 300 which equals 5 minutes. After 4 hours have passed, the 5 minutes TTL will take effect. After the data is already copied to the new server, the old IP address in the current DNS zone is replaced with the new one. This way the DNS propagation time is only 5 minutes now.