Protocols and the OSI Model

11 min read · Updated 2026-09-30

Understanding network communication is foundational to building distributed systems. You don’t need to memorize every protocol — but you do need a working mental model of the layers and what protocols live at each one. That mental model is what lets you debug strange production problems and make informed architectural calls.

The OSI Model

The OSI (Open Systems Interconnection) model is the canonical way to teach networking. Seven layers, each with specific responsibilities, communicating only with adjacent layers.

Application
Application protocols: HTTP, SMTP, FTP, DNS. The interface between user-facing apps and the network.
Presentation
Translation, encryption, compression, format conversion. Ensures compatibility across different systems.
Session
Manages communication sessions between applications.
Transport
TCP, UDP. End-to-end delivery, error detection, flow control.
Network
Routing and logical addressing. IP, ICMP, routing protocols.
Data Link
Frame-level communication within one network segment. Ethernet, WiFi at this layer.
Physical
Cables, wireless signals, hardware specs. The actual wire.

The Real Model — TCP/IP

In practice, the TCP/IP model is what you’ll actually encounter. It collapses some OSI layers and matches modern Internet reality:

OSI layerTCP/IP layerWhat you’ll actually see
Application, Presentation, SessionApplicationHTTP, HTTPS, SMTP, FTP, DNS, gRPC
TransportTransportTCP, UDP, QUIC
NetworkNetworkIP, ICMP, routing
Data Link, PhysicalNetwork AccessEthernet, WiFi, cellular

Application development mostly happens at the Application and Transport layers. The lower layers exist; you’ll touch them only when something is going badly wrong.

TCP vs. UDP

The choice of transport-layer protocol significantly affects system design and performance.

TCP
Reliable, ordered, slow-start
Connection-oriented. Guarantees in-order delivery. Flow control, congestion control, retransmission. Higher latency in exchange for reliability.
UDP
Fast, unreliable, lightweight
Connectionless. Best-effort delivery, no ordering, no flow control. Minimal overhead. Faster, but the application has to handle the loss/reordering problem itself.

TCP wins for:

UDP wins for:

What TCP spends its latency on

  1. Connection establishment. No application bytes move until the handshake finishes.
  2. Acknowledgments. The sender keeps each segment until it is acknowledged. A missing acknowledgment retransmits that segment only.
  3. Two different brakes. Flow control follows the receiver’s advertised window, so a fast sender cannot overrun a slow receiver. Congestion control is separate: a busy path makes the sender slow down.

UDP has neither brake. It writes at the application’s rate and does not notice a saturated network. Retry and reordering stay in the application.

HTTP: The Application-Layer Workhorse

HTTP has gone through several major revisions, each addressing specific performance and compatibility problems. Understanding the differences matters because they affect how your services behave under load.

HTTP/1.1 (1997)
Universal support. One request per TCP connection (with keep-alive). Head-of-line blocking. Verbose plain-text headers. The compatibility floor.
HTTP/2 (2015)
Multiplexing — many requests over one connection. Binary framing. Header compression. Server push. Much better at scale; ubiquitous now.
HTTP/3 (2022)
Built on QUIC (over UDP). No head-of-line blocking on packet loss. Faster connection setup. Best on lossy networks (mobile, varying conditions).

What each version changed

VersionConnectionProtocol detail
HTTP/1.0A new TCP connection per requestNo reuse. Fine for one document, expensive once a page needs many resources.
HTTP/1.1Persistent connection, optional pipeliningHost header: many sites on one IP. Chunked transfer encoding: a body whose length is not known up front. Pipelining may send several requests before any response; most browsers never shipped it, and responses stay strictly ordered.
HTTP/2Many streams on one TCP connectionStreams may finish out of order. A lost TCP segment still blocks every stream, because they share one ordered byte stream.
HTTP/3QUIC over UDPConnection migration keeps the session across a move from WiFi to cellular. Loss recovery is per stream.

Head-of-line blocking, on one connection:

  1. The client sends one slow request, such as a large download, and two fast ones.
  2. HTTP/1.1 is ordered. Responses 2 and 3 wait until response 1 finishes.
  3. HTTP/2 turns the three requests into independent streams. The fast responses return while the slow stream is still open.
  4. HTTP/3 puts each stream on QUIC, so a lost packet stalls only that stream.

For internal service-to-service traffic on stable networks, HTTP/2 is the modern default. For client-facing traffic over the public Internet — especially mobile — HTTP/3 has the edge.

TLS: Encryption at the Transport Boundary

TLS (Transport Layer Security) encrypts data in transit. Modern TLS is TLS 1.2 or TLS 1.3 — older versions (SSL 2/3, TLS 1.0/1.1) are deprecated and insecure.

TLS handshake
Establishes encrypted channel. TLS 1.3 reduced this from 2 round-trips to 1, with 0-RTT for resumption.
Certificates
Server presents a cert chain signed by a trusted CA. Let's Encrypt makes free certs trivial; ACME automates renewal.
mTLS
Mutual TLS — both client and server present certs. Strong identity for service-to-service inside a mesh.
Cipher suites
The algorithm bundle for the connection. TLS 1.3 simplified the choices significantly. Use modern cipher suites (AES-GCM, ChaCha20-Poly1305).

Handshake order

  1. Client Hello lists the cipher suites the client can use.
  2. Server Hello picks one suite and sends the certificate.
  3. The client checks the certificate and the chain back to a CA it already trusts.
  4. Both sides run the key exchange and derive shared keys.
  5. Later records on that connection use those keys.

mTLS runs the certificate check in both directions. The cost is issuing, rotating, and revoking a certificate for every client, plus extra validation on the handshake. One-way TLS, often terminated at a load balancer, fits public clients you do not administer.

DNS: The Hidden Performance Layer

DNS resolves domain names to IPs. Often invisible — until it’s slow, broken, or being abused. Things to know:

For SaaS apps, your platform’s choice of DNS provider (Route 53, Cloudflare, NS1) materially affects latency and reliability.

A Practical Mental Model

When you see a request flow like this:

Browser ──[TLS 1.3]──► CDN ──[HTTP/2]──► API Gateway ──[gRPC over HTTP/2]──► Service

The layers in play:

Knowing which layer is responsible for which property (encryption, ordering, routing) is what makes diagnosing weird latency or connectivity issues tractable.

Recap