Networking & API DesignBeginner16 min read3 questions

How the Internet Works: DNS, TCP, TLS and HTTP

Everything that happens between a user typing a URL and bytes arriving - and why each hop is a place where latency and failure live.

Covers: DNS resolution, TCP vs UDP, the TLS handshake, HTTP/1.1 vs HTTP/2 vs HTTP/3, connection reuse, head-of-line blocking

“What happens when you type a URL into a browser?” is the most-asked warm-up question in the industry, and it is not filler. Every answer you will give later - CDNs, load balancers, connection pooling, keep-alives, why cross-region calls hurt - depends on understanding this sequence.

The full journey of one HTTPS request

Tap each stage. The recurring theme: almost all of the time is spent on round trips, not on computation.

ClientExternalEdgeServiceTap a box for detail

Flow

  • BrowserDNS resolver(resolve)
  • DNS resolverTCP handshake(IP)
  • TCP handshakeTLS handshake
  • TLS handshakeCDN edge
  • CDN edgeOrigin(miss only)
Filter
0/3 mastered
BeginnerdnstcphttpAsked at Google, Amazon

30-second answer

The browser checks its caches, resolves the hostname to an IP via DNS, opens a TCP connection with a three-way handshake, negotiates TLS, sends an HTTP request, and receives a response - usually from a CDN edge rather than the origin. The browser then parses the HTML and repeats the process for every referenced asset. The whole sequence is dominated by round trips, which is why caching, connection reuse and edge termination matter more than server speed.

IntermediatetcpudpquicAsked at Cloudflare, Google

30-second answer

TCP gives ordered, reliable, congestion-controlled delivery at the cost of handshakes, retransmission delay and head-of-line blocking. UDP gives you a fire-and-forget datagram with none of those guarantees and none of that overhead. Use TCP when correctness and completeness matter - APIs, page loads, file transfer. Use UDP when timeliness beats completeness - live video, voice, gaming, DNS, metrics. QUIC is the interesting middle: it runs reliability and congestion control over UDP in user space, so it gets TCP's guarantees per stream without TCP's cross-stream head-of-line blocking.

Intermediateload balancingnetworkingproxyAsked at Amazon, Netflix

30-second answer

An L4 load balancer routes on IP and port without reading the payload - it is fast, protocol-agnostic and cheap, but it cannot make decisions based on the request. An L7 load balancer terminates the connection and parses HTTP, so it can route by path, host or header, retry idempotent requests, do TLS termination, compression, rate limiting and sticky sessions. Use L4 for raw throughput and non-HTTP protocols; use L7 whenever routing decisions depend on the content of the request, which for a modern web system is almost always.

Showing 3 of 3 questions for how-the-internet-works-dns-tcp-tls-http.

Check your understanding

4 questions · no sign-up, nothing stored

0/4 answered
Question 1

1.Roughly how many round trips does a cold HTTPS request cost before the first byte of response, using TLS 1.3?

Question 2

2.Why can HTTP/2 be slower than HTTP/1.1 on a lossy network?

Question 3

3.Which is a genuine advantage of an L7 load balancer over L4?

Question 4

4.Your service streams live audio. A packet is lost. What should happen?

Hands-on challenge

Build it - this is what you talk about in a deep-dive round.

Trace and budget a real page load

Open your browser's network panel on any site and turn the waterfall into a latency budget.

Requirements

  • Record DNS, TCP, TLS and TTFB timings for the document request.
  • Count how many separate origins the page contacts and how many connections it opens.
  • Identify which HTTP version each origin negotiated.
  • Compute what fraction of total load time was round trips versus server processing.
  • List the three changes that would most reduce the time to first contentful paint.

Stretch goals

  • Repeat on a throttled 3G profile and note which bottleneck changes rank.
  • Explain what a CDN would and would not fix in this specific waterfall.