Skip to content
    Architecton

    LOAD BALANCING · 8 MIN

    Load Balancing

    A load balancer spreads incoming requests across healthy servers.

    ARCH explains

    • Round robin: each server in turn.
    • Least connections: the least busy server.
    • Health checks remove failed servers from rotation.

    Real world: A bank token system sending you to the next free counter.

    Watch it move

    LB
    s1■
    s2
    s3

    Request #0 → s1

    1/7

    Code

    servers = ["s1", "s2", "s3"]
    for i in range(5):
        print(i, servers[i % len(servers)])
    Output ›
    0 s1
    1 s2
    2 s3
    3 s1
    4 s2
    Try it in the online compiler →

    Checkpoint quiz

    Round robin with 3 servers: request #7 (0-indexed) goes to…