Beginner22 min readΒ· Topic 1.4

Client-server model

How the internet works, DNS, HTTP/HTTPS, HTTP/2, HTTP/3, WebSockets, Server-Sent Events

🌐Key Takeaways

  • 1
    The client-server model is the foundation of all web architecture
  • 2
    DNS resolves domain names to IP addresses; HTTP is the communication protocol
  • 3
    HTTP/2 adds multiplexing and header compression; HTTP/3 uses QUIC over UDP
  • 4
    WebSockets enable persistent bidirectional communication for real-time features

How the Web Works

Every interaction on the internet follows the client-server model: a client (browser, mobile app) sends a request to a server, and the server processes it and sends back a response. Understanding this flow β€” DNS, TCP, TLS, HTTP β€” is the bedrock of system design.

DNS Lookup

Browser checks local cache β†’ OS cache β†’ Router cache β†’ ISP DNS resolver β†’ Root DNS β†’ TLD DNS (.com) β†’ Authoritative DNS. Returns IP address (e.g., 142.250.80.46).

DNS uses UDP on port 53. Typical time: 20-120ms for a cache miss.

HTTP Versions Compared

FeatureHTTP/1.1HTTP/2HTTP/3
TransportTCPTCPQUIC (UDP)
MultiplexingNo (one req per conn)Yes (streams)Yes (streams)
Head-of-line blockingYesAt TCP levelNo
Header compressionNoHPACKQPACK
Server pushNoYesYes
Connection setup1 RTT + 1 RTT (TLS)1 RTT + 1 RTT (TLS)1 RTT (or 0-RTT)

Real-Time Communication

Persistent bidirectional connection. Client sends HTTP Upgrade request, server responds with 101 Switching Protocols. After that, both sides can send messages at any time.

Use cases: chat, live sports scores, collaborative editing, trading platforms.

Downsides: stateful connection complicates load balancing; need sticky sessions or shared state.

Advantages

  • β€’Foundation of all web architecture
  • β€’Well-understood and standardized protocols
  • β€’HTTP/3 dramatically improves performance

Disadvantages

  • β€’WebSocket state complicates scaling
  • β€’TLS adds latency to new connections
  • β€’DNS can be a bottleneck if cache misses

πŸ§ͺ Test Your Understanding

Knowledge Check1/2

What protocol does HTTP/3 use as its transport layer?