High Level Design

Networks

Network fundamentals for system design — OSI model, DNS, HTTP, TCP vs UDP, REST vs GraphQL, WebSockets, WebRTC, and video streaming protocols.

August 10, 2026

Network refers to how components of a system communicate with each other — whether on the same machine, different servers, or across the globe.

It involves: data transmission, protocols (HTTP, TCP, gRPC), latency/throughput/bandwidth, load balancing, failover, and security (encryption, firewalls).

Where Networks Are Used#

LayerExample
Client ↔ BackendHTTP API calls from browser/mobile app
Service ↔ ServiceMicroservice-to-microservice communication
App ↔ DB/CacheTCP connections to PostgreSQL/Redis
App ↔ Message QueueKafka, RabbitMQ messaging
CDN ↔ ClientStatic file delivery via Cloudflare, etc.

OSI Model#

OSI Model

LayerNameDescription
1PhysicalHardware, cables, routers, switches
2Data LinkMAC addresses; node-to-node delivery
3NetworkIP addresses; routing between networks
4TransportTCP/UDP; end-to-end delivery, flow control
5SessionOpening/closing sessions between apps
6PresentationData formatting, encryption/decryption
7ApplicationProtocols like HTTP, DNS, SMTP

IP Address#

A unique identifier for a device on the internet or local network. Expressed as four numbers from 0–255 (e.g., 192.168.1.38).

MAC Address#

A physical hardware address embedded in a NIC (Network Interface Card). Works at the Data Link Layer (Layer 2). Unique 48-bit identifier per network card.

ISP — Internet Service Provider#

Connects users to the internet via wired (fiber, cable) or wireless (Wi-Fi, mobile data) connections.


DNS — Domain Name System#

Translates human-readable domain names (www.amazon.com) to machine-readable IP addresses (192.0.2.44).

DNS resolution flow:

  1. Browser checks its DNS cache
  2. If not cached → queries recursive DNS resolver (ISP or Google 8.8.8.8)
  3. Resolver contacts root DNS server
  4. Root points to TLD server (.com, .org)
  5. TLD points to authoritative DNS server for the domain
  6. Authoritative server returns the IP (A record for IPv4, AAAA record for IPv6)
  7. Browser connects to that IP

DNS working diagram


HTTP#

The foundation of data exchange on the web. A client-server protocol where clients (browsers) send requests and servers return responses.

HTTP overview


Internet Protocols#

TCP — Transmission Control Protocol#

  • Connection-oriented; establishes a connection before data transfer
  • Reliable: handles lost, out-of-order, duplicate, and corrupted packets
  • Used for: web browsing (HTTP/HTTPS), email (SMTP), file transfer (FTP)

TCP/IP model

UDP — User Datagram Protocol#

  • Connectionless; no connection setup overhead
  • Unreliable: no guarantee of delivery or ordering
  • Fast: minimal overhead
  • Used for: video streaming, online gaming, VoIP, DNS

TCP vs UDP#

FeatureTCPUDP
ConnectionConnection-orientedConnectionless
ReliabilityReliableUnreliable
Error RecoveryDetection + retransmissionBasic checksum only
SpeedSlower (overhead)Faster (minimal overhead)
Use CasesHTTP/HTTPS, email, FTPStreaming, gaming, VoIP, DNS

TCP vs UDP


API Protocols#

REST#

  • Architectural style based on resources and HTTP methods
  • Multiple endpoints for different resources
  • Stateless; easy to cache GET requests
  • Best for: simple CRUD-based microservices

GraphQL#

  • Query language for APIs; single endpoint
  • Client requests exactly the data it needs — no over-fetching or under-fetching
  • No versioning needed (schema evolves)
  • Best for: complex data relationships, frontend-driven apps

REST vs GraphQL#

FeatureRESTGraphQL
EndpointsMultiple (one per resource)Single endpoint
Data FetchingOver-fetch or under-fetchExactly what's needed
VersioningNeeds /v1, /v2Schema evolves — no versioning
CachingEasy (HTTP cache for GET)Custom caching needed
Error HandlingHTTP status codesErrors in response body

Microservice Communication#

gRPC (Google Remote Procedure Call) is the standard for service-to-service internal communication. Uses Protocol Buffers (binary serialization) — language-agnostic and efficient.


Video Streaming#

Why HTTP Alone Isn't Enough#

  • Videos are broken into chunks. HTTP is stateless, so each chunk request must specify which chunk.
  • HTTP runs over TCP — for live streaming, if a packet drops, retrying is pointless (the data is already old). UDP is better for live streaming.

HTTP-DASH (Dynamic Adaptive Streaming over HTTP)#

  • Client signals its bandwidth capacity to the server
  • Server adapts video quality accordingly (720p, 480p, etc.)
  • Runs over TCP for guaranteed delivery
  • Apple devices use HLS (HTTP Live Streaming) — similar concept

WebRTC#

For video conferencing, routing through a server is inefficient.

  • Peer-to-peer protocol — no central server needed for data
  • Clients get peer addresses from a signaling server, then connect directly
  • Faster; saves bandwidth; more resilient (if server crashes, call continues)

Glossary#

TermDefinition
DDoSDistributed Denial of Service — flooding a system with malicious traffic
NATNetwork Address Translation — maps private IPs to public IPs for internet access
WebSocketTwo-way interactive communication session between browser and server
XMPPExtensible Messaging and Presence Protocol for real-time messaging
Head-of-Line BlockingA packet at the front of a queue blocks others even if they're ready
HTTP/2Solves HOL blocking via multiplexing (breaks messages into independent frames)
HTTP/3 (QUIC)Uses UDP instead of TCP; eliminates TCP-level HOL blocking
HLSHTTP Live Streaming — Apple's video streaming protocol