Have you ever tried to conduct a search on Google only to receive a “page not found” error? This can be perplexing—surely Google’s massive infrastructure could never simply disappear. If the error remains even after verifying your Internet connection or switching web browsers, it turns out the culprit could be closer to home.
Path to successful access: A DNS server
Whenever you visit Google.com, or any other website, your request travels through a hierarchy of domain name service (DNS) servers, and the server closest to you will reply with the Internet protocol (IP) address. This also occurs any time you visit a website or check Facebook, for example, from your mobile app. DNS servers will resolve the logical name of the resource you are attempting to access with the site’s universally identifiable IP address—a numerical address that locates that particular resource on the Internet. If the primary and secondary DNS servers in your path malfunction and fail to return Google’s IP address, you will receive an error. But, how does a DNS really work? How does it impact your business? And, more importantly, how are DNS servers crucial to scaling applications and distributing content quickly?
Storing records: what a DNS does
There are thousands of DNS providers on the Internet. Each DNS provider maintains authority over the records it services. Google, for example, has its own DNS provider that contains records for each of its microsites, such as mail.google.com. The three most common DNS record types are:
- The A record: The A record is the simplest record in DNS. The A record associates a logical name to an IP address. For example, the A record for harvard.edu is 18.104.22.168. The Harvard DNS maintains A records for subdomains, too, like iq.harvard.edu. Subdomains may have their own authoritative DNS server, depending on their architecture.
- The CNAME: The CNAME record is the second-most commonly used record type. A CNAME record refers one logical name to another. As an example, consider the distinction between www.google.com and google.com. At first glance, they appear to be equal, but a DNS will register them differently. A CNAME record equates www.google.com and google.com as the same address.
- The MX record: The MX record is either a logical name or an IP address. The MX record specifies what host is responsible for handling email for a particular domain.
Redundancy: How a DNS is central to the Internet
So, DNS providers contain records that associate logical names to IP addresses. But how is a DNS structured, given that there are innumerable DNS servers operating at any moment? The entire Internet depends on root DNS providers. Root DNS providers are authoritative for top-level domains like .edu, .org, and .com. Using Google as an example again, the following steps demonstrate just how you receive Google.com’s IP address from a hierarchy of name servers:
- The root DNS: When you visit google.com, your DNS request—which asks for Google’s associated IP address—reaches one of the primary root DNS servers. The root DNS provider refers you to the DNS server for the .com top-level domain.
- The .com DNS server: The second-level DNS server authoritative for .com refers your request to the DNS provider authoritative for google.com.
- Google.com’s DNS server: Google’s DNS provider responds with the IP address of google.com.
If you had to recursively search every DNS at multiple levels in order to receive an answer to your request, network performance would be compromised. If millions of Internet users were querying root DNS servers simultaneously, the Internet would simply collapse. DNS has a way around this: caching.
Caching servers: Realizing DNS performance
Every computer connected to the Internet has a primary and secondary DNS server configured. When you open Google, you’re querying your primary and secondary DNS providers first. Your preconfigured DNS servers actually cache the records of DNS servers with greater authority. Your local DNS provider contains a cached record for google.com and returns the IP address immediately. How does this work?
- DNS, a distributed architecture: A DNS is a distributed architecture. DNS servers at lower levels cache results for all queries. When you access google.com, your local DNS provider returns a cached answer. This cached answer is refreshed based on its time to live (TTL). TTL is a numerical value that specifies how long a record remains accurate. When a record’s TTL expires, subsequent requests are cached and the process begins again.
- DNS caching, quickly serving content: DNS caching becomes very powerful when it is used to scale content. DNS and anycast technology permits images, video, and even multimedia to be cached locally—closer to the actual requesting client. When you visit a high-traffic website like Google or Amazon, images and multimedia residing on those websites are serviced from a location physically closer to you, rather than from Google or Amazon’s own servers.
Scalability: How a DNS has the innate ability to scale
A DNS server can contain multiple A records or multiple CNAME records for a single logical name. When you perform a DNS lookup on google.com, you will see that it has multiple A records. This means that whenever you perform a DNS request for google.com, you’ll receive a different IP address on Google’s network. This allows for great performance. Technologies like GeoIP boost performance, too. With GeoIP, a DNS provider will return the IP address of a server physically closest to you, strongly increasing the performance of any content-heavy web application.
The bottom line: mobilizing DNS to serve your content
If you are a small- or medium-sized business, properly utilizing DNS makes a difference. Building an infrastructure that places content across the globe—and makes use of caching technology based on anycast or load balancing using GeoIP—will provide the extra performance that really makes a difference to content consumers and customers.
Image source: Wikimedia Commons