🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
💼 Servicesℹ️ About✉️ ContactView Pricing Plansfrom $10

Networking Fundamentals

FoundationsNetwork Infrastructure🟢 Free Lesson

Advertisement

System Design Foundations

Networking Fundamentals

Every distributed system communicates over networks. Understanding networking—from the physical layer to application protocols—is essential for making informed design decisions about latency, throughput, and reliability.

  • TCP/IP — Reliable, ordered byte streams over unreliable networks
  • HTTP/HTTPS — The application protocol that powers the web
  • DNS — The internet's phonebook for name resolution

The network is never as reliable as you think it is.

The Network Stack

Networks are organized in layers, each abstracting the details of the layer below.

The OSI and TCP/IP Models

TCP/IP ModelApplication (HTTP, DNS, SMTP)Transport (TCP, UDP)Network (IP, ICMP)Link (Ethernet, Wi-Fi)Key System Design Relevance:Application: API protocols, content negotiationTransport: Connection management, reliabilityNetwork: Routing, IP addressing, subnetsLink: Physical connectivity, MTU limits

TCP vs UDP

TCP Three-Way Handshake

ClientServerSYN (seq=x)SYN-ACK (seq=y, ack=x+1)ACK (seq=x+1, ack=y+1)Connection established. One round-trip of latency before data can flow.
FeatureTCPUDP
ConnectionConnection-orientedConnectionless
ReliabilityGuaranteed deliveryBest-effort
OrderingOrdered bytesUnordered datagrams
OverheadHigher (headers, state)Lower (minimal headers)
LatencyHigher (handshake)Lower (no handshake)
Use CasesHTTP, SSH, databases, emailDNS, video, gaming, VoIP

HTTP/HTTPS

HTTP is the foundation of data communication on the web.

HTTP Methods and Semantics

MethodSemanticsIdempotentSafeUse Case
GETRead resourceYesYesFetching data
POSTCreate resourceNoNoSubmitting forms, creating
PUTReplace resourceYesNoFull updates
PATCHPartial updateNoNoPartial modifications
DELETERemove resourceYesNoDeleting resources
HEADMetadata onlyYesYesHealth checks
OPTIONSCapabilitiesYesYesCORS preflight

HTTP Status Codes

Code RangeCategoryExamples
1xxInformational100 Continue, 101 Switching Protocols
2xxSuccess200 OK, 201 Created, 204 No Content
3xxRedirection301 Moved Permanently, 304 Not Modified
4xxClient Error400 Bad Request, 401 Unauthorized, 404 Not Found
5xxServer Error500 Internal Server Error, 503 Service Unavailable

HTTP/2 and HTTP/3

HTTP/2 introduced:

  • Multiplexing: Multiple requests over a single TCP connection
  • Header compression: HPACK reduces overhead
  • Server push: Proactively send resources

HTTP/3 (QUIC-based):

  • 0-RTT connection establishment: No TCP handshake delay
  • No head-of-line blocking: Independent stream ordering
  • Built-in encryption: TLS 1.3 integrated

DNS (Domain Name System)

DNS translates human-readable domain names to IP addresses.

DNS Resolution Process

ClientRecursive ResolverRoot NameserverTLD (.com)AuthoritativeIP: 93.184.216.34

DNS Record Types

RecordPurposeExample
AMaps domain to IPv4example.com → 93.184.216.34
AAAAMaps domain to IPv6example.com → 2606:2800:220:1:...
CNAMEAlias to another domainwww.example.com → example.com
MXMail exchange serversexample.com → mail.example.com
TXTText information (SPF, DKIM)"v=spf1 include:..."
NSNameserver for domainexample.com → ns1.example.com
SOAStart of authority metadataZone authority info

DNS Caching

DNS uses multi-level caching for performance:

  • Browser cache: Typically 60 seconds to 30 minutes
  • OS cache: System-level DNS resolver cache
  • ISP resolver cache: Shared across customers (TTL-based)
  • Authoritative server: Source of truth

Content Delivery Networks (CDNs)

CDNs cache content at edge locations closer to users to reduce latency.

CDN Cache Strategies

StrategyDescriptionTrade-off
Pull CDNEdge requests from origin on cache missOrigin controls freshness
Push CDNOrigin pushes content to edgesFaster but requires invalidation

CDN Architecture

Origin ServerEdge: US-EastEdge: EU-WestEdge: APACEdge: LATAMUSEUASIALATAM

Network Latency

Understanding latency is critical for system design decisions.

Realistic Latency Numbers

DistanceMinimum RTT (Fiber)Practical RTT
Same data center< 1ms0.5 - 2ms
Same city (100km)~1ms2 - 5ms
Cross-country (4000km)~40ms50 - 80ms
Transatlantic (8000km)~80ms100 - 150ms
Transpacific (15000km)~150ms160 - 200ms

Practice Exercises

  1. Conceptual: Why does HTTP/3 use QUIC instead of TCP? What specific problem does this solve for modern web applications?

  2. Calculation: A user in Tokyo accesses a server in New York. The fiber path is 11,000 km. Calculate the minimum light propagation RTT. If the practical RTT is 140ms, what is the overhead?

  3. Design: Design a DNS strategy for a service that requires < 5 minute failover. What TTL values would you use? What are the trade-offs?

  4. Analysis: Compare HTTP/1.1, HTTP/2, and HTTP/3 for a single-page application that loads 50 resources. How does each version handle parallelism and head-of-line blocking?


What to Learn Next

-> API Design REST, GraphQL, gRPC, versioning, and rate limiting.

-> Databases SQL vs NoSQL, indexing, replication, and sharding.

-> Caching Strategies Redis, Memcached, cache invalidation, and write strategies.

-> Load Balancing Algorithms, health checks, and L4 vs L7.

-> Message Queues Kafka, RabbitMQ, event-driven architecture.

-> Scalability Fundamentals Vertical vs horizontal scaling and capacity planning.

Need Expert System Design Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement