System Design: Building Blocks - DNS
DNS, is the abbreviation of Domain Name System
DNS is a internet naming service that map the human-friendly domain name to machine-readable IP address.
It’s like a phone book like repository that can maintain all mappings between the domain name and its real IP address.
Components
DNS is a complete infrastructure with name server at different hierarchies.
DNS Resolver
Resolver initiate the query sequence and forward request to other DNS name server
This component is acting as the entry point of the overall system, which interact with client, get the query request and return the result.
Root Level Name Server
Receive the request from DNS resolver, then return a list of TLD server, which contains the domain of requested
Top Level Domain (TLD) Name Server
these servers hold the IP addresses of authoritative name servers.
Authoritative Name Server
these are the organization’s DNS nameserver that provide the IP addresses of web
Work Flow
- Client send query request to DNS resolver
- DNS resolve contact Root Level Nameserver to get the possible TLD nameservers
- Then either let client or itself, go to the TLD nameserver to query the authoritative nameserver
- Then go to authoritative nameserver to get the real IP address of queries website
Evaluation
We usually evaluate the designed system in following aspect:
Scalability, Reliability and Availability
Reliability
three main reason make the DNS a reliable system
- caching: even if some DNS server are temporarily down, cached records can be served to make DNS as a reliable system
- replication: redundant server improve the reliability
- UDP protocol: DNS server are using UDP as communication protocol , which only need one round trip so that provide a shorter delay .
Scalability
Due to the hierarchical nature, DNS is a highly scalable system.
Different portions of the tree enabling scalability and manageability
Consistency
In DNS system, we compromise the consistency for the higher performance and availability.
We can imagine, DNS system is a read-heavy system, so we should prioritize the read performance over write performance.
That means, we shouldn’t block the read operations until the write operations get completely synced across all components.
So we would adopt the eventual consistency.