How to Reduce DNS Lookups to Improve Website Performance

A DNS lookup is the process of discovering the right IP address for a particular website's URL. DNS lookups can be critical when gauging a website's performance as they directly affect TTBF, LCP, and FCP. This article explains how DNS lookups work, what kind of effects too many DNS lookups have on UX and SEO, as well as offers suggestions for reducing DNS Lookups using different strategies.

If you want to optimize the performance of your website and ensure it is fast loading for both visual and technical reasons, then reducing DNS lookups is a critical factor in this equation.  By reducing DNS lookups, you can boost user experience and reduce page loading time – both of which are integral elements for any successful website. With this blog post, we will first explain how DNS works and define what a DNS lookup is. We’ll also explore how browser speed and SEO metrics can be affected by having too many DNS lookups and provide strategies to reduce them in order to optimize your webpages for improved performance.

All You Need to Know About DNS Lookups 

What is a DNS lookup?

Domain Name Servers (DNSs) are the cornerstone of the Internet. They function like telephone directories for websites, associating them with their IP addresses. A DNS lookup is the process of discovering the right IP address for a particular website’s URL.

It is the process by which a DNS server returns information about a DNS record to a requester, including:

  • Who, what, and where is this domain name?
  • What is the IP address, who owns it, and where is it located?
  • What is the name of the record? 

DNS lookup results

DNS lookups are classified into two types: forward DNS lookups and reverse DNS lookups.

Forward DNS Lookups

The forward DNS lookup, or forward DNS query, is a request that obtains an IP address via a domain search. When a user writes a website URL or sends an email, an IP address is returned as part of the regular DNS query path.

The method allows a client to convert a domain name or email address into an IP address that can be used to communicate with the server.

Reverse DNS Lookup

Reverse DNS is essentially the inverse of forward DNS. The request determines the domain name associated with an IP address. To confirm the legitimacy of the servers from which messages are being received, email servers frequently conduct reverse lookups.

For this operation to be completed, a pointer record (PTR) must be created on the mail server. Mail servers rely on these records to determine which IP address is authoritative for sending and receiving mail for the domain in question.

An IP owner (usually the host or ISP for the email server) assigns a zone to the server that ends “in-addr.arpa” and has several digits preceding it. The digits at the beginning of the zone are a reversed version of the server’s IP block.

Reverse DNS Lookup

How Does DNS Lookup Work?

When you visit a website, your browser identifies all resources requiring a DNS query. Then, it awaits the completion of the lookup before downloading any resources.

The more lookups a website needs, the longer it takes for the browser to generate its pages. A quick DNS lookup example is provided below to understand the lookup procedure. 

Assume a browser wishes to establish a connection with an “xyz-server.com” web server. For this, it needs the IP address of the server. The computer initially checks to see whether the inputted name is in its cache or in its host’s file. If not, it inquires with the server in charge. This was allocated through DHCP or is permanently configured.

If the server can fulfill the request, it returns the response to the requester. If this is not the case, it contacts another server responsible for the domain. With the provided IP address, the browser can interact over the IP network with the web server (Internet).

When working with PageSpeed Insights, the “Reduce initial server response time” option is linked to DNS lookup:

"Reduce initial server response time" option linked to DNS

The Time To First Byte (TTFB) begins with an HTTP request. The time it takes a server to process a request depends on how quickly a DNS query can be completed, how fast the user’s network is, how far away the server is, and if the connection was interrupted.

Since PageSpeed Insights can not help us determine what is triggering DNS Lookup, we will have to utilize additional tools to isolate and resolve this issue.  To determine how to fix the issue, let’s examine how DNS lookup works.

What does it mean to reduce DNS lookups?

It is common knowledge that website loading speed is one of the most important SEO and search engine ranking elements. The quicker your website loads, the higher your search engine ranks. Specifically, you may see the fundamental web essentials while doing a Google page performance test.

DNS lookups can be critical when gauging a website’s performance as they directly affect LCP (Largest Contentful Paint) and FCP (First Contentful Paint). LCP is defined as the time taken for a website’s primary content to load, whereas FCP is the timeframe from when a user requests the page until the browser renders anything on the screen. DNS lookup times strongly influence how quickly those elements load and, thus, how users experience a website. As technology continues to improve, optimization of DNS lookup times will become ever more important for ensuring great UX.

Note
To learn more about Core Web Vitals read Core Web Vitals: The Only Guide You’ll Ever Need.

It is so crucial since more than fifty percent of people choose to leave websites that take longer than three seconds to load. The DNS lookup enters the picture at this stage. If your website can do DNS lookups instantaneously or as fast as possible, it will improve the LCP, FCP, and TTFB of the webpage, as well as the TTFB of resources on the page, such as images or scripts, or styles.

Let’s examine an example to illustrate how DNS lookups contribute to the total page loading time. When you input a website URL or domain name into your browser’s address bar, the DNS lookup procedure will begin.

The DNS will then attempt to retrieve the requested website by attempting to match the entered domain with the IP address of the website. Now, the website you are attempting to access is prepared to load. However, if the DNS lookup procedure does not exist, you must input the website’s IP address instead of the domain name each time you want to access the site. And if it takes one second for the DNS lookup page to finish the procedure. It would be far more than what Google suggests.

Therefore, it is of the utmost importance to reduce DNS lookups times. Generally, a DNS lookup takes between 20 and 120 milliseconds. Generally, anything between that and under is considered to be very good. Now, let’s examine how to improve DNS response time and decrease DNS lookups.

How are UX and SEO affected by too many DNS lookups?

For User Experience (UX) designers and Search Engine Optimization (SEO) professionals, too many DNS lookups can be a major issue. As the number of requests a website makes to Domain Name Servers increases, it can slow down loading times significantly, resulting in a poor user experience. Additionally, Google’s search engine looks unfavorably on websites with long loading times, meaning that even though your content may be valuable and optimized, it will be buried due to poor performance. Designers and professionals need to ensure that the number of DNS lookups is minimized whenever possible. 

In addition, DNS may influence SEO results in a number of ways. Some are evident, while others are less so. Let’s examine each separately.

Site loading speed

Prior to a website being loaded in a visitor’s browser, the DNS is the first procedure that occurs. As previously stated, DNS resolution might be a lengthy process that will add to the total time the visitor experiences. There is a significant difference between an average of 20 milliseconds with a good DNS provider from around the globe and 200 milliseconds to 500 milliseconds when everything is left to the domain registrar.

Availability

Frequent and prolonged DNS outages have a negative impact on your site’s search engine optimization. If a search engine bot attempts to access your site but is unable to, it will report this event. First, it will be slower at indexing newly added pages. Second, it will include a note about general availability, which could negatively impact your site’s ranking.

Multiple locations

A DNS provider may provide multiple points of presence (PoPs) from which you can set name servers. It will significantly increase the visitors’ speed by shortening the path between them and the name servers. 30+ PoPs is certainly superior to a few. Additionally, it will boost availability.

DNS migration 

If the DNS transfer is completed successfully and the required precautions are followed, neither users nor search engine bots should notice any change. The issue arises only if the TTL values of the preceding DNS records are very high and such DNS records remain in the DNS caches of recursive name servers for an extended period of time. They will continue to point to the outdated IP until the caches are updated, resulting in downtime.

How to do a DNS lookup speed test?

There might be several causes for a lengthy response time, including server load, network unpredictability, race conditions in your JavaScript that affect the load order, etc. If your website loads inconsistently, you should run a few profiles in the performance tab of developer tools with network throttling enabled to see the results. 

Taking the time to do a DNS lookup speed test can help ensure your website runs as fast as possible. Pingdom, GTmetrix, and WebPageTest are all powerful tools that allow you to examine the DNS lookup time of your site. 

You must sign up for the service and input your website’s address to use them. The results will then provide a detailed breakdown of requests to identify your domain name system. From there, you can pinpoint areas that need improvement to reduce loading times and keep visitors engaged with your content. Taking control of the DNS lookup performance of your website is an essential step towards maintaining optimal business operations online.

Now let’s take a look at each tool and how you can perform a speed test:

Pingdom DNS Lookups

To test your DNS lookup using Pingdom, visit their tools page and input the URL of your website:

Pingdom DNS Lookups

Under the “Improve page performance” area, you may determine at a glance whether you are experiencing this issue:"Reduce DNS lookup" issue“Reduce DNS lookup” is in red and has a failing grade. This website has no cache, performance plugins, and many faults.

Scroll down for a more extensive explanation of the DNS lookup problem. This pink bar indicates the DNS response time in milliseconds. While hovering over each file request, you can observe whether files need a DNS search and how long it takes to load.

extensive explanation of the DNS lookup problem

GTmetrix DNS Lookups

If you would like to identify what is causing the more prolonged DNS lookup on GTmetrix, type the URL in the test tool:

GTmetrix DNS Lookups

In the Waterfall tab, hover over specific file requests to see the DNS lookup measured in milliseconds.

DNS lookup measured in milliseconds

It’s important to review each file and determine whether it has a DNS lookup and how long it takes to load. The goal should be to achieve a response time of 40ms or less.

WebPagetest DNS Lookups

Despite Pingdom and GTmetrix being great tools, WebPagetest seems to provide more specific results. Go to their website and enter your URL:

WebPagetest DNS Lookups

Upon completion of the test, click “View” and select “Details”:

WebPagetest DNS Lookups

When you click on the “DNS lookup” column, you can arrange your request information by the fastest response time.

WebPagetest DNS Lookup requested information table

How to reduce DNS Lookups

DNS lookups can cause significant delays in website loading speeds, which is why preventing unwanted DNS lookups is important.  Fortunately, there are strategies we can use to optimize DNS lookups for our websites and enhance user experience. The following strategies will help you reduce DNS lookups:

Use a Rapid DNS Service

Utilizing a high-quality DNS service is the most crucial factor. There are several free and premium DNS services.

When you purchase domain names from prominent registrars like GoDaddy, NameCheap, or NameSilo, you get free DNS. These DNS providers often need to be more active, and as the request size grows, so does the DNS lookup time.

Then there are DNS providers like Amazon and Cloudflare, whose POPs are spread over numerous nations. Premium DNS services are quick and have minimal latency.

Best DNS Providers

Source

Reduce the number of hosts

Reducing the number of hostnames is a simple yet effective technique to reduce the number of Domain Name System (DNS) lookups. Each hostname has its own set of DNS queries that must be made for webpages and resources to be retrieved from them. Therefore, decreasing the number of hostnames required for a webpage can significantly reduce the time needed for its loading speed. The easiest way to reduce this number is to combine several hosts’ resources. This can include employing techniques such as asset concatenation and distribution through a single CDN, reducing redirects, removing outdated domain sharding and more. Taking these steps during the design process is crucial for ensuring your site performs well and continues to attract an audience.

Put it simply, if you have a webpage that needs resources from 10 different hosts, you can reduce the load on your DNS by consolidating these resources onto fewer hosts. This can be achieved by combining file types and reusing existing domain names for multiple applications. By doing this, there is less strain on the DNS as each domain name only needs to be looked up once. This is an effective method to reduce time lags in loading web pages and make browsing faster for users.

Use CDN

Moving as many resources as possible to a CDN provider is one of the simplest strategies to decrease DNS lookups. If you operate your website using Pingdom, you may see the overall number of domain requests. This sample demonstrates that 93.8% of requests are sent to the CDN URL. One request is sent to the host, while the other is sent to Google Analytics. By shifting as many resources as possible to a content delivery network (CDN), the number of DNS lookups is decreased, hence lowering load times.

Obviously, it will only sometimes be feasible to transfer everything to your CDN. There will always be external materials or services that must be loaded from their respective servers. However, we encourage browsing your website. We frequently see WordPress customers with many resources needing to be properly housed on their CDN. This allows you to maximize the benefits of HTTP/2 and parallelization.

The recent integration of Cloudflare enterprise CDN into 10Web Booster Pro provides users with a powerful, reliable web performance boost. It helps to ensure that irreplaceable assets like images and videos are delivered faster, even during worldwide traffic spikes. Utilizing the advantages of both Cloudflare’s advanced caching services and 10Web Booster’s optimization features gives users an unbeatable solution for customizing their website speed and user experience. This new integration perfectly combines the convenience and reliability of Cloudfare’s global delivery network with 10Web Booster Pro’s comprehensive optimization suite.


Enable Keep-Alive

Enabling keep-alive is a different approach to decreasing DNS lookups. It refers to maintaining an active connection between a server and a browser to load multiple asset files simultaneously.

Without it, resource files are loaded as separate requests, even though a single domain may contain many resources. For instance, one asset from “facebook.com” and three resources from “Twitter.com” would result in four DNS queries.

With keep-alive enabled, the same resources would be loaded with only two queries in total. Keep-alive is supported by all major browsers and is enabled by default in the majority of instances. On Apache and Nginx servers, you may re-enable it if it is deactivated.

For Apache

If you are using an Apache server, you should modify the .htaccess file as follows:

<ifModule mod_headers.c>

Header set Connection keep-alive

</ifModule>

For NGINX

Find the HTTP core module (ngx_http_core_module), search for a line similar to keep-disable, and replace it with the following one.

keepalive_disable none;

Use DNS cache to your benefit

DNS caches (also known as DNS resolver caches) are temporary DNS records that are stored on a device (such as your computer or mobile phone) and hold data regarding previously visited domain names (such as A records for IPv4 addresses or AAAA records for IPv6 addresses). It maintains these data based on their remaining lifespan (TTL).

Each time you visit a website, its address will be stored in this temporary database of records in order to expedite a subsequent visit. The DNS caching enables the browser to remember the domain’s IP address. The browser is not required to perform a request in order to locate the IP. In the first speed test, the DNS lookup time is often longer than in the second.

The duration of the DNS cache is referred to as TTL or Time to Live.

TTL settings may be modified using your domain registrar or a third-party DNS service in order to increase DNS cache times. It is essential to understand that ISPs cache DNS as well. Below are some typical TTL values.

  • 300 seconds = 5 minutes
  • 1800 seconds = 30 minutes
  • 3600 seconds = 1 hour
  • 43200 seconds = 12 hours
  • 86400 seconds = 24 hours

Cloudflare TTL: Cloudflare TTL values between 30 minutes and one hour are often the most popular. However, some additionally set their TTL to a relatively low value to facilitate rapid updates. Cloudflare is one example of a service whose default TTL is five minutes. Additionally, it might be advantageous to examine the various sorts of DNS records and configure them depending on how often they change. Here’s an illustration:

  • A and AAAA records: Modify more regularly; somewhere between 5 minutes and 1 hour is generally acceptable.
  • CNAME entries very seldom change; a TTL of 24 hours is often enough.
  • NS records almost seldom change; a TTL of 24 hours is often acceptable.
  • Change MX records less often; a TTL of 12 hours is generally acceptable.
  • TXT records: Modify less often; a TTL of 12 hours is generally enough.

Regarding TTL, there is no definitive right or incorrect response. Choosing a TTL that corresponds to the frequency with which your website is updated will enhance DNS lookup performance, though.

In summary, DNS caching should be used to your advantage. With caching, the browser is able to determine the hostname without consulting the DNS. Establishing a successful DNS caching strategy is critical to a high-performing website or application. Because of this, it is important to choose the most appropriate setup for DNS caching. In most cases, placing a recursive resolver in the network that can cache domain names and other associated information for an extended period of time is an effective approach. It helps reduce latency by ensuring lookups are resolved quickly and locally. Additionally, deploying split-horizon DNS across multiple locations offers increased availability and redundancy for distributed applications. Ultimately, choosing the right setup for DNS caching can be the difference between having satisfied customers and frustrated users.

DNS prefetching 

DNS prefetching DNS Prefetching allows the browser to do a DNS lookup invisibly in the background while the user navigates the current page.

When a user clicks on any link to go to the next page, the website does not do a DNS lookup. Thus, the subsequent page loads rapidly.

You may rapidly implement DNS prefetching with a single tag line.

Your link is located at https://www.yourlink.com.

DNS prefetching

You can quickly add the DNS prefetching with the simple line of tag.

<link rel="dns-prefetch" href="https://www.yourlink.com">

A tiny link attribute can make a difference in the landing speed of the DNS.

Lower the amount of CNAME records

CNAME records are used to associate multiple hostnames with the same IP address, and while they can be useful in certain settings, they can result in an excessive number of DNS lookups if not managed carefully. Tapping into the potential of CNAME records without an undesirable increase in DNS lookups begins with understanding how these records interact with your domain and then taking a few simple steps to lower their amount. 

ANAME records, which serve the same function as CNAME but at the root level, are the best solution.

Consequently, ANAME records contribute more to the site’s performance than CNAME records.

Delay JavaScript parsing and loading of not critical CSS

Delaying the Javascript will delay the processing of Javascript till after the page content has loaded. Loading Javascript before the other components of the page will slow down the page’s loading time, since Javascript prevents the loading of other resources until it has been completely processed. If scripts are loaded from a different domain requiring DNS lookup, then delaying their load will help to get rid of that DNS lookup entirely.


The straightforward answer is to load Javascript at the end or asynchronously. WordPress users have access to a variety of free Plugins, including 10Web Booster, which offers effective solutions to two critical website performance issues: JS execution and CSS delivery. 

The JS delay technique implemented in Booster can help reduce the parsing and execution of JavaScript code, significantly improving website speed.  The delay technique boils down to minimizing the number of JavaScript files and chunks that need to be loaded on the page at once, proactively managing requests before they even happen, while Critical CSS pushes any staging code style or design elements needed in a visible manner inline into the page to eliminate extra loads when rendering websites. This advanced approach solves potential website speed issues, meaning pages are rendered instantly, resulting in an improved user experience and higher rankings in search engine results.

Track Your DNS Lookup Time

Continuously benchmarking your website is the simplest technique to comprehend how DNS lookup times affect website performance. This will provide a clearer picture of what must be changed and where the bottlenecks are. You need a monitoring tool that can record your website’s load times for this purpose. Consider one that can evaluate more than DNS lookup times, since you must also monitor other vital website metrics to maintain your website’s overall performance.

Conclusion

Optimizing DNS lookups is a crucial part of website optimization and the improvement of user experience. The article explains how DNS lookups work, how to reduce them, and what kind of effects too many DNS lookups have on UX and SEO, and offers suggestions for reducing DNS Lookups using different strategies.

Too many DNS lookups can add unnecessary time to page load speed and negatively impact the user experience. Your site’s performance and ranking in search engines will be preserved if you prevent unwanted DNS lookups. However, there are ways to reduce DNS lookups and improve your site’s speed. By following the tips outlined in this blog post, you can ensure that your site runs at peak efficiency. 

Do you have any other tips to reduce DNS lookups? Share them with us in the comments below!

FAQ

What causes slow DNS lookups?

There are many possible causes for slow DNS lookups, including a bad DNS server, incorrect DNS settings, a slow internet connection, or too many simultaneous DNS requests from other applications or devices on your network.

How many DNS lookups are too many?

There is no definitive answer to this question, as the number of DNS lookups that are too many will vary depending on the configuration and usage of each website. Usually, 10-15 lookups per second are the maximum before you start seeing response delays.

Is there a WordPress plugin to reduce DNS lookups?

Yes, a few WordPress plugins help reduce DNS lookups, such as 10Web Booster, LiteSpeed cache, and WP Rocket.

What are the fastest DNS providers?

Some fastest DNS providers include Google Public DNS, OpenDNS, and CloudFlare’s own Public DNS service.

How do I reduce DNS lookups in CloudFlare?

DNS lookups can be reduced by enabling full compression, which will compress both the responses from Cloudflare and the requests to Cloudflare.
In addition, using a CDN like Cloudflare also allows you to cache static files (e.g., images, CSS, JavaScript) at its edge nodes so that these files don’t have to be downloaded again from the origin server. This can reduce DNS lookups since the files are served from a local cache instead of being looked up over the Internet.

Want to speed up your website instantly?

Share article

Leave a comment

Your email address will not be published. Required fields are marked *

Your email address will never be published or shared. Required fields are marked *

Comment*

Name *