LinkedIn Tag
cside partners with Chargebacks 911 to counter chargeback fraud
Learning

What is DNS?

DNS is the internet’s phonebook that maps out a site’s URL (like cside.dev) to the numeric IP address of where the servers hosting those sites are.

Simon Wijckmans
Simon Wijckmans
Founder & CEO

Ever used your phone’s contacts app? Imagine that, but for the internet. DNS is the internet’s phonebook that maps out a site’s URL (like cside.dev) to the numeric IP address of where the servers hosting those sites are. Without DNS, we’d have to remember and input those numerical IP addresses for every single website - an impractical task for most humans, given we rely on our phones to save numbers already.

image-of-two-astronauts-one-pointing-a-gun-to-another-with-texts-wait-its-all-dns?-always-has-been-with-earth-on-the-backgound

How DNS works

When you visit a website, your browser asks a DNS resolver to find the IP address of the domain you’re trying to visit. This resolver is usually your internet service provider’s DNS server, or a public DNS service like CloudFlare. 

If the answer isn’t already cached, the DNS resolver will perform a recursive lookup, which goes through the following topology:

  • The DNS root server sends the query to the right top-level domain (eg, .dev)
  • The top-level domain server points the query in the direction of the domain’s authoritative servers
  • The authoritative server provides the final IP address for the domain, sending it back to the resolver to cache and deliver to your browser.

This resolution often happens super quickly, but it has to happen before a website can start loading.

DNS Lookup Time

DNS lookup time is the duration from when your system sends a DNS request to when it receives the answer from a lookup server. Generally, this speed only takes a few milliseconds, but it adds to your page’s load time. Typical queries range from 20 to 120 milliseconds, and “optimal” DNS speed is considered to be under 50 milliseconds or less.

This speed matters because visitors will be waiting before your website even begins to load, bottlenecking the rest of the content until the IP is resolved. If your DNS is sluggish, it will make your site feel slower - and if the query times out or fails, users might just assume the site is down and give up.

You also have to consider the number of DNS lookups that are required to load a page. Your browser only does one query per unique domain, but if your site pulls third-party content from many different sites, it has to perform multiple lookups. These queries can add up, so limiting the number of external domains on your site will reduce this DNS overhead and help load content quicker.

Why Caching Helps Performance

Thankfully, lookups don’t have to happen on every single visit, thanks to caching. DNS caching stores the results of DNS lookup queries so that repeat requests for the same domain can be looked up much, much quicker without contacting external servers.

A DNS record has a value called a TTL, or Time to Live, that describes how long it should be kept in a cache. As long as a cached entry hasn’t expired or changed, the resolver and/or your device will use the saved IP address and skip the full lookup. This allows for essentially zero lookup delay on the second page load, and cuts down on DNS-related wait time.

Related Articles