← Back🌐

Foundations: Wires & Voices — Networking & Protocols

AWAKENING0 / 100
[░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░]0%

Foundations: Wires & Voices — Networking & Protocols

High Level Design·beginner·~25 min read

  • basics
  • networking
  • protocols
  • load-balancing
  • api-gateway

- Communication Protocols - OSI Model & Networking Fundamentals - Load Balancer Types - Proxies - API Gateway and Service Discovery ---

What you'll learn

  • Communication Protocols

    | Protocol | Direction | Use Case | When to Choose | |----------|-----------|----------|----------------| | HTTP/REST | Request-Response | Most APIs | Default for 90% of interviews | | SSE | Server → Client | Notifications, live scores |…

  • Protocol Mechanisms Deep Dive

  • Protocol Comparison Matrix

    | Capability | REST | WebSockets | gRPC | GraphQL | UDP | Long-Polling | |-----------|------|-----------|------|---------|-----|-------------| | External APIs | Yes | Yes | No | Yes | Yes | Yes | | Bidirectional | No | Yes | No | No | Ye…

  • TCP vs UDP

    | Aspect | TCP | UDP | |--------|-----|-----| | Connection | Connection-oriented (3-way handshake) | Connectionless | | Reliability | Guaranteed delivery, retransmission | Best-effort, no guarantee | | Ordering | Preserves order | No ord…

  • REST API Best Practices

    | Practice | Rule | |----------|------| | URL structure | Nouns (not verbs): /users/123/posts not /getPostsByUser | | HTTP methods | GET=read, POST=create, PUT=full update, PATCH=partial update, DELETE=remove | | Idempotency | GET, PUT,…

  • Identity vs Payload — Why User IDs Belong in the Token, Not the Body

    The rule: authenticated endpoints must read the caller's identity from the verified auth token, never from the request body or URL. Violating this is the single most common source of IDOR (Insecure Direct Object Reference) bugs in produc…

  • OSI Model & Networking Fundamentals

  • The 7-Layer OSI Model

    Layers 7-5 = Host layers (software, application-level concerns) Layers 4-1 = Media layers (transport and physical delivery)

  • TCP/IP Model (Practical Mapping)

  • SSH vs SSL vs Telnet

    | Protocol | Purpose | Encryption | Port | Key Difference | |----------|---------|-----------|------|----------------| | SSH | Remote shell access + commands + file transfer | Yes (symmetric + asymmetric) | 22 | Creates secure tunnel for…

  • L4 vs L7 Load Balancing (OSI Context)

    | Aspect | L4 (Transport Layer) | L7 (Application Layer) | |--------|---------------------|----------------------| | Sees | TCP/UDP packets only | Full HTTP request (URL, headers, cookies, body) | | Routes by | IP + port | URL path, host…

  • Load Balancer Types

    | Type | Layer | Capabilities | Best For | |------|-------|-------------|----------| | L7 (Application) | HTTP | Routes based on URL, headers, cookies | API routing, path-based | | L4 (Transport) | TCP | Distributes connections without i…

  • Web Server vs Application Server

    | Aspect | Web Server (Nginx, Apache) | Application Server (Tomcat, Gunicorn) | |--------|---------------------------|--------------------------------------| | Primary purpose | Serve static content (HTML, CSS, JS, images) | Execute busi…

  • Implementation Options

    | Type | Pros | Cons | When to Use | |------|------|------|-------------| | Software LB (e.g., HAProxy, Nginx) | Easy to set up, runs locally on each machine, manages health checks automatically | Additional process per machine | Default…

  • Redundant Load Balancers

    A single load balancer is itself a single point of failure. Production systems use an active/passive cluster: - Both LBs monitor each other via heartbeat - If the active LB fails, the passive detects missed heartbeats and promotes itself…

  • Balance at Every Layer

    A scalable system needs load balancing at multiple layers — not just at the edge: Each layer adds both capacity (horizontal scalability) and redundancy (losing a node reduces capacity proportionally without disruption). ---

  • Proxies

    A proxy is an intermediate server between client and backend. Two main types:

  • Forward Proxy (Client-side)

    Sits in front of clients. The backend servers don't know the real client identity. Types of forward proxy: - Open Proxy (Anonymous) — accessible by any internet user; hides client IP from the server - Transparent Proxy — identifies itsel…

  • Reverse Proxy (Server-side)

    Sits in front of servers. The client doesn't know which backend server handles the request. Use cases: Load balancing, SSL termination, compression, caching, serving static content, shielding backend from direct exposure. Key insight: A…

  • API Gateway and Service Discovery

  • API Gateway Responsibilities

    An API Gateway sits at the entry point of a microservices system: | Responsibility | What It Does | |---------------|-------------| | Rate limiting | Track request counts per IP/user, block excessive traffic | | Protocol translation | HT…

  • Service Registry Pattern

    Services register themselves with a central registry that maps service names to available instances: - Services self-register on startup with their IP, health check endpoint, and handler routes - Gateway caches registry lookups locally (…

  • Database-Per-Service Pattern

    Each microservice owns its database exclusively: | Benefit | Why | |---------|-----| | Access isolation | Developers can't accidentally read other service's data | | Independent scaling | Each DB scales based on its service's needs | | T…

← back to High Level Design

Foundations: Wires & Voices — Networking & Protocols — High Level Design | GoCrack | GoCrack