What is Domain Name System (DNS)?
Everything on the internet relies on the Domain Name System (DNS) which can be related to a phone book. When you enter the domain name or URL of a website in your browser, the DNS translates that domain name to the corresponding IP address, which your browser uses to load that website.
What is a DNS Cache?
A DNS Cache is a temporary, local database that contains all the records of a computer’s recent visits to websites. Technically saying, a DNS Cache acts as a cache memory to store the recent DNS lookups that helps your computer load the websites faster. You can relate it to the much familiar browser cache.
Though there are tons of public DNS servers on the internet to find the IP addresses of the user requested domain names, sometimes it takes a while to load the websites or get the response. This is where the DNS Cache comes into picture. Since it’s locally stored, the whole lookup process happens much faster. Your Operating System creates and keeps a cache for the websites you have recently visited. When you revisit those websites, the browser can get the details from the local cache instead of sending requests to remote DNS servers and looking up the information all over again.
How to view DNS Cache records in Windows, Mac and Linux?
1) Windows
ipconfig /displaydns
You will see a number of DNS Cache entries in the result, depending upon the number of websites you recently visited, which will look like the following:
2) Mac
To view the Unicast DNS Cache:
sudo discoveryutil udnscachestats
To view the Multicast DNS Cache:
sudo discoveryutil mdnscachestats
3) Linux
DNS Caching is not enabled by default in all Linux distributions. To have DNS caching, you can preferably install the name service caching daemon (NSCD) for DNS Caching. If your OS uses NSCD, use the following command to view the cache statistics:
sudo nscd -g
If your system uses systemd-resolved, execute the following command:
systemd-resolve --statistics
It is also important to note that the DNS cache is to be cleared regularly to keep the cache records up to date and also prevent the cyber security threats like DNS cache poisoning or DNS spoofing. To understand more about the importance of flushing the DNS Cache and how to do it, check this post.
1 thought on “What is DNS Cache? How does a DNS Cache make websites load faster?”
Comments are closed.