Back to course
    article~28 min readSystem Design FoundationsQuiz Available

    How The Internet Works

    Understand the journey from browser request to bytes on screen.

    How The Internet Works — Beginner Friendly System Design Guide

    You Opened Swiggy. What Actually Happened?

    You tap the Swiggy app.

    Within milliseconds:

    • your phone talks to DNS servers
    • connects to internet providers
    • reaches Swiggy servers
    • fetches restaurant data
    • downloads images
    • renders UI

    All before you even blink.

    That “instant loading” feeling is not magic.

    It is:

    • networking
    • protocols
    • servers
    • caching
    • distributed systems

    working together.


    Why This Topic Matters

    Before learning:

    • microservices
    • databases
    • load balancing
    • distributed systems

    you must first understand:

    How computers communicate over the internet
    

    Every system design concept depends on this foundation.


    The Internet Is Just Computers Talking

    Very simple idea:

    Internet = Millions of computers communicating
    

    Just like humans need:

    • address
    • language
    • delivery system

    computers also need:

    • IP addresses
    • protocols
    • network routing

    Real Example — Opening Zomato

    Suppose you open:

    zomato.com
    

    What happens behind the scenes?


    High-Level Flow

    User Opens Zomato
            │
            ▼
    DNS Finds IP Address
            │
            ▼
    Browser Connects To Server
            │
            ▼
    HTTPS Secure Connection
            │
            ▼
    HTTP Request Sent
            │
            ▼
    Server Processes Request
            │
            ▼
    Database + Cache Access
            │
            ▼
    Response Returned
            │
            ▼
    App/UI Rendered
    

    Step 1 — DNS Resolves Domain Name

    Humans remember:

    zomato.com
    

    Computers use:

    142.xxx.xxx.xxx
    

    called IP addresses.


    What Is DNS?

    DNS stands for:

    Domain Name System
    

    It works like internet's phonebook.


    Real-Life Analogy

    Instead of remembering:

    • everyone's phone number

    you save:

    • names in contacts

    DNS does same thing.


    DNS Flow

    User Types zomato.com
            │
            ▼
    Browser Checks Cache
            │
            ▼
    DNS Resolver Asked
            │
            ▼
    DNS Returns IP Address
            │
            ▼
    Browser Connects To Server
    

    Step 2 — TCP Connection

    Now browser knows:

    • where server exists

    Next:

    • connection must be established

    using:

    TCP
    

    What Is TCP?

    TCP means:

    Transmission Control Protocol
    

    It ensures:

    • packets arrive correctly
    • data remains ordered
    • lost packets are retried

    Real-Life Analogy

    Imagine sending pages of book through courier.

    TCP ensures:

    • no pages missing
    • pages stay in correct order

    TCP Three-Way Handshake

    Before sending data:

    client and server establish connection.


    TCP Handshake Flow

    Client                Server
       │                     │
       │ ---- SYN ---------> │
       │                     │
       │ <--- SYN-ACK ------ │
       │                     │
       │ ---- ACK ---------> │
       │                     │
    Connection Established
    

    Why Handshake Matters

    Every connection adds latency.

    Approximate latency:

    RouteLatency
    Delhi → Mumbai20-40 ms
    India → Singapore40-60 ms
    India → USA180+ ms

    Physics matters.


    Step 3 — HTTPS Secure Connection

    Modern websites use:

    HTTPS
    

    instead of HTTP.


    Why HTTPS Exists

    Without encryption:

    • passwords visible
    • payments exposed
    • tokens stealable

    especially on public WiFi.


    HTTPS Uses TLS

    TLS encrypts communication.


    HTTPS Flow

    Browser Connects
           │
           ▼
    Server Sends Certificate
           │
           ▼
    Browser Verifies Certificate
           │
           ▼
    Encryption Keys Generated
           │
           ▼
    Secure Communication Starts
    

    Lock Icon Meaning

    The browser lock icon means:

    Connection is encrypted
    

    NOT:

    • website is trustworthy

    Step 4 — HTTP Request

    Now browser sends request.

    Example:

    GET /restaurants HTTP/1.1
    Host: zomato.com
    

    Server Responds

    HTTP/1.1 200 OK
    Content-Type: application/json
    

    with restaurant data.


    Important HTTP Status Codes

    CodeMeaning
    200Success
    301Redirect
    400Bad request
    401Unauthorized
    403Forbidden
    404Not found
    500Server error
    503Service unavailable

    Step 5 — Data Travels As Packets

    Internet does NOT send one giant file.

    Data is broken into:

    Packets
    

    Small chunks of data.


    Example

    A 5 MB image may become:

    • thousands of packets

    Packets may:

    • take different routes
    • arrive out of order
    • get lost

    TCP handles reconstruction.


    Packet Flow

    Large File
        │
        ▼
    Split Into Packets
        │
     ┌──┼──┬──┐
     ▼  ▼  ▼  ▼
    P1 P2 P3 P4
        │
        ▼
    Internet Routing
        │
        ▼
    Packets Reassembled
    

    Step 6 — CDN Serves Static Content

    Images/videos usually come from:

    CDN
    

    instead of main server.


    What Is CDN?

    CDN means:

    Content Delivery Network
    

    Servers distributed globally.


    Example — Hotstar IPL Streaming

    If Jaipur user watches IPL:

    • content served from nearby Indian CDN server
    • not USA server

    Much faster.


    CDN Flow

    User
      │
      ▼
    Nearest CDN Server
      │
      ├── Cached Content Exists
      │         │
      │         ▼
      │    Return Fast
      │
      └── Not Cached
                │
                ▼
           Origin Server
    

    Step 7 — Backend Server Processing

    Application server may:

    • authenticate user
    • fetch restaurants
    • calculate offers
    • check Redis cache
    • query database

    Backend Architecture Example

    Mobile App
        │
        ▼
    Load Balancer
        │
        ▼
    Application Servers
        │
     ┌──┴─────────┐
     ▼            ▼
    Redis       Database
    Cache
    

    What Is UDP?

    Not all internet traffic uses TCP.

    Some use:

    UDP
    

    TCP vs UDP

    TCPUDP
    ReliableFaster
    Ordered deliveryNo guarantee
    Retries packetsNo retries
    Higher latencyLower latency

    Real Examples

    ApplicationProtocol
    WebsitesTCP
    PaymentsTCP
    WhatsApp MessagesTCP
    Video CallsUDP
    GamingUDP
    DNSUsually UDP

    Why Video Calls Prefer UDP

    In video calls:

    • speed matters more than perfection

    Better:

    • small glitch

    than:

    • delayed conversation

    Real Internet Journey — Swiggy Example

    User Opens Swiggy
            │
            ▼
    DNS Resolves Domain
            │
            ▼
    TCP Connection Created
            │
            ▼
    TLS/HTTPS Handshake
            │
            ▼
    HTTP Request Sent
            │
            ▼
    Load Balancer
            │
            ▼
    Application Server
            │
     ┌────┼─────┐
     ▼          ▼
    Redis      Database
            │
            ▼
    Response Returned
            │
            ▼
    UI Rendered
    

    Why Internet Speed Feels Slow Sometimes

    Possible bottlenecks:

    ProblemExample
    Slow DNSDomain lookup delayed
    High latencyServer far away
    Packet lossWeak network
    Slow backendDatabase issue
    CDN missFetching from origin
    TLS overheadSecure connection setup

    Common Beginner Misconceptions


    "Internet Is Cloud Magic"

    No.

    It's:

    • routers
    • cables
    • servers
    • protocols
    • data centers

    working together.


    "HTTPS Means Safe Website"

    No.

    HTTPS only means:

    • encrypted connection

    Website itself may still be malicious.


    "Database Is Always Slow Part"

    Not always.

    Sometimes issue is:

    • DNS
    • network
    • frontend
    • TLS handshake
    • CDN

    Always profile full request path.


    Key Takeaways

    ConceptPurpose
    DNSDomain → IP
    TCPReliable communication
    HTTPS/TLSEncryption
    HTTPRequest-response protocol
    CDNFaster content delivery
    PacketsSmall transferable data chunks
    Load BalancerTraffic distribution

    Final Mental Model

    Internet
       │
       ▼
    DNS
       │
       ▼
    TCP Connection
       │
       ▼
    HTTPS Encryption
       │
       ▼
    HTTP Request
       │
       ▼
    Load Balancer
       │
       ▼
    Application Server
       │
     ┌─┴─────────┐
     ▼           ▼
    Cache      Database
       │
       ▼
    Response Returned
    

    One-Line Interview Definition

    The internet works through interconnected networks where clients and servers communicate using protocols like DNS, TCP/IP, HTTPS, and HTTP to exchange data reliably across the globe.

    Module context

    How the internet actually works, the client-server model, databases, and APIs. The building blocks every architect needs before anything else.

    Mark this lesson complete when you finish reviewing it.