Wondering what DNS lookups are and how to reduce them? In our guide, we explain the role of a DNS and how the whole lookup process works. Because a fast DNS is fundamental to webpage performance, we are also sharing some tips to reduce unnecessary DNS lookups on your site.
What is DNS?
A Domain Name System (DNS) is the “phonebook of the internet” that translates human-readable domain names (www.rocket-cdn.me) to machine-readable IP addresses (188.8.131.52) so browsers can load content to a specific user.
When a domain name is created, it’s automatically registered in a server network that you could associate with a worldwide directory. Thanks to that system, the Internet knows that this name exists and that it corresponds to a website located on a particular server. The DNS lists every domain information allowing access to the site, e-mails, or subdomains.
What Are DNS Lookups?
A DNS lookup is the process by which a DNS server returns a DNS record data to the requester, such as:
- What, who, where is this domain name?
- What, who, and where is this IP address?
- What’s the record name?
DNS is all about looking up and connecting information to addresses. You can compare it to a giant worldwide directory like the “Yellow Pages” of the internet. Whenever you access a site, click on a result on Google, or follow a link, a request is made to the DNS (Domain Name System), which is unique worldwide.
Forward vs Reverse DNS Lookups
They find information related to the domain, only the search method is different. Forward DNS lookups mean you have a domain name but not the IP address. On the opposite, reverse DNS lookups imply that you know the IP address but need to locate a domain.
How DNS Lookups Work
When a user enters a URL in their browser, DNS starts connecting that URL to the server’s IP address. But how exactly does it do that? To fully understand how DNS lookups work, we need to go over the four DNS servers:
- Resolving name server = receives the request and goes to each server, looking for the right IP address.
- Root name server = that’s the name server for the root zone. It redirects the resolving name server to find the correct TLD name server.
- TLD name server = the top-level domain server (TLD) that refers to the .com .fr .co.uk, .org, .net etc.
- Authoritative name server = the final step for a DNS query: it finally has the DNS record for the request.
The figure below shows the whole process explained for the conversion to the final IP address.
How to Identify DNS Records
DNS records or (zone files) contain the information stored in the DNS servers. These instructions are crucial, and all domains must have a few essential DNS records for a user to access their website.
The most common types of DNS records are:
- A records: hold the IP address of a domain
- AAAA records: contain the IPv6 address for a domain
- CNAME records: associate a subdomain to the primary or canonical domain
- MX records: associate a domain with an email server
- TXT records: associate any arbitrary text to a domain
|📖 DNS Records = all the relevant information servers need to properly translate email addresses, domain names, and subdomains into meaningful numerical addresses
📖 DNS Lookup = the process of querying a record from a domain name system server
Impact of DNS Lookups on Performance
All those DNS lookups take time to complete and may have an impact on performance and your page speed. According to Sematext.com, the average DNS lookup time is between 20 and 120 milliseconds – so any lookups in that range are considered acceptable.
If you are interested in checking your own DNS lookup time, you can use Pingdom, WebPageTest, or GTmetrix. In our example below, the DNS lookup time is 121 ms which is right on the limit in terms of performance.
In the next section, we show you how to maintain a low DNS lookup time for your WordPress site.
How to Reduce DNS Lookups Time
Now that you know how a DNS works, we are sharing 6 performance tips on reducing DNS lookups time:
- Use a CDN
- Use a Fast DNS Provider
- Implement DNS Prefetching
- Reduce the Number of CNAME Records
- Change Time to Live (TTL) Values And Take Advantage of The DNS Cache
1. Use a CDN
To reduce DNS lookups time, you can serve your data through a content delivery network (CDN). Storing your resources on a CDN will help further improve loading times as users will be delivered content from the closest edge server. On top of that, hosting files on a CDN helps release the load on the origin server.
2. Use a Fast DNS Provider
DNS speed depends on many things, including the distance to your nearest server and the server having enough bandwidth to perform all the queries it receives. Here’s a comparison report to help you make up your mind:
If you are interested, Techradar also made a list of the fastest DNS providers in 2022.
3. Implement DNS Prefetching
Another tip for reducing DNS lookups time is to take advantage of DNS prefetching, meaning that the browser will operate DNS lookups on a page in the background.
There are two ways of implementing DNS prefetching:
The manual way by adding some lines of code to the header of your WordPress site:
<!– DNS Prefetching –>
<link rel=”dns-prefetch” href=”//URL1.com”>
<link rel=”dns-prefetch” href=”//URL2.com”>
The easy way with a WordPress plugin like WP Rocket. From the WordPress dashboard, go to Preload > Prefetch DNS Requests and add the requests you want to preload (e.g., Google Analytics, Font Awesome, Google Fonts, and others).
4. Reduce the Number of CNAME Records
CNAME records usually produce an extra lookup time which – when accumulated – creates small amounts of waiting time. To go further, Cloudflare created an advanced guide about CNAME flattening.
5. Change Time to Live (TTL) Values And Take Advantage of The DNS Cache
DNS Caching can be useful to minimize DNS lookups because fewer lookups will be required for each page load. How does it work? The DNS cache stores the hostname for a set amount of time, and when a user requests the element, the browser displays it from the cache. This prevents an extra DNS lookup from being performed during a given period of time.
This amount of time set in the cache is Time to Live (TTL). By adjusting TTL, you can change the length of the DNS cache and optimize performance. For your reference, here are some commonly acceptable TTLs for each DNS record:
- CNAME Records – TTL 24 hours
- A and AAAA Records: TTL 5 minutes to an hour
- MX Records- TTL 12 hours
- TXT Records – TTL 12 hours
DNS lookups can easily contribute to a large portion of your total loading time if you are not careful enough. With our 6 tips, you can start optimizing your WordPress site as soon as possible and make sure that unnecessary lookups do not impact your performance.
CDNs are one of the easiest and safest ways to prevent useless DNS lookups from happening. That’s why, in our next and final section, we will go over RocketCDN, a powerful (and affordable) CDN that can help you reduce your DNS lookups.
Reducing DNS Lookups with RocketCDN
RocketCDN reduces DNS lookups, makes your website load faster, meets Core Web Vitals requirements, and improves the overall user experience. Let’s go over the best features of RocketCDN that will boost your performance to any visitors worldwide.
✅ Comes with more than 121 edge servers to reduce DNS lookups across the world
Powered by Bunny CDN, RocketCDN offers more than 121 PoPs (edge servers), preventing DNS lookups to be triggered from the original server. Moving your resources to RocketCDN will optimize the number of DNS lookups going through the edge servers, decreasing the load times.
✅ Automatically creates a CNAME record
RocketCDN automatically applies the best performance settings to your website. There is no manual configuration to perform! For instance, it automatically creates your unique rocket-cdn.me CNAME. All you need to do is to connect your website to the CDN in the field below:
✅ Automatically sets the right Time To Live (TTL) for DNS records
RocketCDN defines the perfect Cache Time To Live (TTL) for your website. It automatically sets the most efficient time, including the TTL for DNS records.
✅ Compatible with WordPress and all the other ecosystems
RocketCDN is one of the best CDN for your WordPress site, and it’s also compatible with every other CMS! For WordPress users, it gets even easier. There is a dedicated WordPress plugin that automatically points all your assets to RocketCDN.
The configuration steps are straightforward.
Install the free RocketCDN plugin and paste your API key as shown in the field below:
That’s it, RocketCDN handles the rest for you.
✅ Comes with unlimited bandwidth while being affordable
RocketCDN only costs $8.99/month ($7.99/month for WP Rocket’s clients) and provides unlimited bandwidth.
RocketCDN helps to reduce DNS lookups thanks to caching and edge servers located around the world. Not only will it secure your site, it will also make you reach your performance goals. There are no advanced DNS settings to perform on the user’s side. RocketCDN takes care of everything.