What happens when you type a web address into the browser and press Enter? Go deep on how DNS works.
ReportedSource: GeeksforGeeks interview experience: Apple
Caches, then recursive DNS resolution (root -> TLD -> authoritative, cached by TTL), TCP/QUIC + TLS handshake, HTTP request via LB/CDN, then parse, layout, paint and fetch sub-resources.
1. URL parsing and caches. The browser checks HSTS, its own cache, and whether a connection to the host is already open.
2. DNS resolution.
- Browser cache, then OS cache and
hostsfile. - Stub resolver asks the configured recursive resolver (ISP or 8.8.8.8).
- On a miss the resolver queries a root server (gets the
.comTLD servers), then the TLD server (gets the domain's authoritative name servers), then the authoritative server (gets the A/AAAA record, possibly via CNAME). - Each answer is cached for its TTL.
3. Connection. TCP three-way handshake (or QUIC for HTTP/3), then a TLS handshake: certificate verification, key exchange, session keys.
4. Request and response. HTTP GET with headers and cookies; servers behind load balancers or CDNs return HTML (or a redirect).
5. Rendering. Parse HTML into the DOM, CSS into the CSSOM, run JavaScript, build the render tree, layout, paint, composite; fetch sub-resources in parallel.
DNS follow-ups to expect. Record types (A, AAAA, CNAME, MX, NS, TXT), UDP port 53 with TCP fallback, DNS-based load balancing and GeoDNS, DNSSEC and DNS-over-HTTPS.