The protocol stack
Layers bottom to top
- IP (Layer 3) — addresses and routes packets between hosts; no delivery guarantee.
- TCP / UDP (Layer 4) — transport: reliability vs speed.
- TLS (Layer 4–5) — encryption and identity on top of TCP.
- HTTP/1.1, HTTP/2, HTTP/3 (Layer 7) — request/response semantics for APIs and web.
- WebSocket — full-duplex channel over HTTP upgrade (covered in a later article).
Application │ HTTP GET /api/v1/feed
TLS │ encrypted record
TCP │ segment, port 443
IP │ packet, src → dst
Network stack (StreamHub request)
NETWORKL7 HTTP/2 + RESTAPI Gateway / ALB
NETWORKL4 TCPALB → EKS targets
NETWORKL3 IP + VPCsubnets · security groups
NETWORKDNSRoute 53 resolves hostname
TCP vs UDP
| Aspect | TCP | UDP |
|---|---|---|
| Delivery | Guaranteed, ordered | Best effort, no order guarantee |
| Connection | 3-way handshake, stateful | Connectionless |
| Overhead | Higher (retransmits, flow control) | Lower latency |
| Use cases | HTTP, APIs, databases | DNS, video streaming, gaming, VoIP |
Delivery
TCPGuaranteed, orderedUDPBest effort, no order guaranteeConnection
TCP3-way handshake, statefulUDPConnectionlessOverhead
TCPHigher (retransmits, flow control)UDPLower latencyUse cases
TCPHTTP, APIs, databasesUDPDNS, video streaming, gaming, VoIP
Default to TCP for APIs; choose UDP when loss is acceptable and latency dominates.
StreamHub uses TCP for all API traffic and metadata. Live low-latency preview streams experiment with UDP-based protocols (WebRTC) where occasional frame loss is acceptable.
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 5 sections
- HTTP versions
- TLS essentials
- Connection lifecycle and latency
- Ports and firewalls
- Protocol choice for APIs
Test yourself
Answer these before moving on — recall is what makes it stick.