DNS
A domain name must be turned into an address
A user enters a readable name such as api.example.com, but a network connection needs the address of a node.
DNS — Domain Name System — maps domain names to the data required to reach a system,
including IP addresses.
For System Design, it is useful to see DNS as the first infrastructure step on the request path. Until the name is resolved, the client simply has nowhere to send the connection.
client
|
| resolve api.example.com
v
DNS resolver
|
| address
v
service endpoint
How name resolution happens
An application normally does not walk through the entire DNS hierarchy itself. It asks a DNS resolver, which either returns a cached answer or obtains the required information from the DNS system and stores it for some period of time.
DNS responses contain different record types. For example, an A record maps a name to an IPv4 address,
AAAA maps it to an IPv6 address, and CNAME points to another domain name.
For architecture work, it is more important to understand that a name may lead not directly to an application,
but to the next infrastructure layer.
Cache and TTL
DNS answers are cached so that full resolution does not happen for every request. The amount of time a record may stay in cache is controlled by its TTL — time to live.
A large TTL reduces DNS traffic and keeps answers stable, but address changes propagate more slowly. A small TTL allows faster switching to new values, but increases traffic to DNS infrastructure.
DNS can participate in routing
A single name can map to multiple possible entry points. A DNS provider can choose an answer based on a policy, such as the user's region or site availability. This makes it possible to direct a client toward a suitable part of the infrastructure before a connection is established.
DNS usually does not replace components that distribute individual requests inside the selected site. It operates earlier and at a different level: it helps the client determine where to connect in the first place.