← All system designs

Transport Layer

UDP and TCP — multiplexing, reliable delivery, flow control, congestion control, the algorithms that make the Internet work.

7 items 3 Foundational 4 Intermediate

The transport layer is the most-asked-about networking topic in interviews because almost everything you build runs on top of it. UDP is short (a header, a checksum, a payload); TCP is long (handshake, flow control, congestion control, retransmission, teardown). Both reward depth — engineers who can explain AIMD or the three-way handshake clearly stand out.

The modern story includes QUIC (a transport built on UDP that solves TCP's connection-establishment cost) — worth knowing as part of HTTP/3's adoption.

Key concepts

  • Transport multiplexes app traffic onto IP — ports are how
  • UDP is fire-and-forget; TCP adds reliability, ordering, flow control, congestion control
  • Three-way handshake (SYN, SYN-ACK, ACK) opens; four-way (FIN, ACK, FIN, ACK) closes
  • Sliding window + cumulative ACK is how Go-Back-N and TCP both work
  • Congestion control (AIMD, slow start, fast retransmit) is what prevents Internet collapse

Reference template

// TCP's machinery, in order
1. Open       (3-way handshake)
2. Reliable   (sequence numbers, ACKs, retransmits)
3. In-order   (receiver buffers + reorders)
4. Flow       (advertised window — receiver-side limit)
5. Congestion (cwnd — sender-side limit)
6. Close      (4-way: FIN/ACK both ways)

Adapt to your problem; the structure is the load-bearing part.

Common pitfalls

  • Confusing flow control (receiver protection) with congestion control (network protection)
  • Forgetting that TCP without window scaling caps at 64KB in-flight — fine on LAN, terrible across continents
  • Treating UDP as 'fast TCP' — UDP has zero delivery guarantees, you write them at the app layer (or use QUIC)
  • Skipping TLS overhead when reasoning about HTTP performance

Related topics

Items (7)

Search ESC

Keyboard shortcuts

Shortcuts are disabled while typing in inputs.