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.

DNS: The phonebook of the internet - Source: RocketCDN
DNS: The phonebook of the internet – Source: RocketCDN

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 (77.131.193.251) so browsers can load content to a specific user. 

DNS guides traffic on the web by connecting domain names with actual web servers - Source: RocketCDN
DNS guides traffic on the web by connecting domain names with actual web servers – Source: RocketCDN

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:

How a DNS lookup looks on Windows - Source: Linuxhint
How a DNS lookup looks on Windows – Source: Linuxhint

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. 

Forward vs reverse DNS lookups - Source: whatismyip
Forward vs reverse DNS lookups – Source: whatismyip

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: 

The figure below shows the whole process explained for the conversion to the final IP address. 

How DNS lookups work - Source: RocketCDN
How DNS lookups work – Source: RocketCDN

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:

📖 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.

Checking my DNS lookup time - Source: GTmetrix
Checking my DNS lookup time – Source: GTmetrix

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:

  1. Use a CDN 
  2. Use a Fast DNS Provider
  3. Implement DNS Prefetching
  4. Reduce the Number of CNAME Records
  5. Change Time to Live (TTL) Values And Take Advantage of The DNS Cache
  6. Defer Loading of JavaScript

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.

CDNs help to reduce DNS lookup time – Source: RocketCDN

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:

DNS speed comparison – Source: DNSmadeeasy

 

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).

Prefetching DNS Requests with WP Rocket – Source: WP Rocket

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:

6. Defer Loading of JavaScript

Deferring JavaScript will optimize your above-the-fold content, and your visitors  will start to see your website content sooner. It does not always directly impact DNS lookups, but it will prevent them from being called immediately. It’s an important performance technique that makes your website perceived as fast in the user’s eyes. 

Deferring JS with WP Rocket – Source: WP Rocket

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. 

RocketCDN reducing lookup times and off-loading the origin server - Source: RocketCDN
RocketCDN reducing lookup times and off-loading the origin server – Source: RocketCDN



✅ 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:

Connecting the website to RocketCDN – Source: RocketCDN

✅  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.

Setting TTL automatically to reduce long DNS lookups - Source: RocketCDN
Setting TTL automatically to reduce long DNS lookups – Source: RocketCDN

✅  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:

Connecting RocketCDN to a WordPress site (For WordPress users) - Source: RocketCDN
Connecting RocketCDN to a WordPress site (For WordPress users) – Source: RocketCDN

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. 

Make your website faster by reducing DNS lookups with RocketCDN today!