← Academy

Load Balancers

Distributing traffic evenly across backend fleets

A Load Balancer (LB) acts as a traffic cop sitting in front of your web servers. It intercepts all incoming HTTP/HTTPS queries and distributes them across a fleet of backend servers.

Why do we need it?

  • High Availability: If one server crashes, the load balancer routes traffic to the surviving servers seamlessly.
  • Scalability: By adding more servers behind the load balancer, your application can handle millions of requests without changing client configurations.
  • Resource Optimization: Prevents any single server from becoming a bottleneck by spreading the CPU/Memory load.
  • In this scenario, we have a Client sending parallel requests, a Load Balancer, and 3 Web Servers.

    Load balancers decide where to route traffic using specific algorithms:

  • Round Robin: Routes requests sequentially (Server 1 ➔ Server 2 ➔ Server 3 ➔ Server 1). It assumes all servers have equal capacity.
  • Random: Dispatches requests completely at random. Useful for testing or when request load is extremely light.
  • IP Hash: Computes a hash of the client's IP address (e.g. 192.168.1.50) and maps it to a specific server. This ensures the same client *always* lands on the same server, preserving session/cache persistence.

  • Interactive Checkpoints

    Click on the check-points below to configure the simulator instantly and see them in action!

    Visualize Round Robin Routing

    Load

    Click here to set the Load Balancer to 'Round Robin' and run the simulation. Watch how each request goes sequentially to Server 1, 2, and 3.

    Enforce IP Hash Stickiness

    Load

    Click here to set the strategy to 'IP Hash'. Run the simulation to see how a client's requests stick to a single server based on their IP hash value.

    In the real world, servers crash or undergo updates. A load balancer uses health checks to detect dead nodes. If a server is unhealthy (or has zero capacity), the load balancer skips it and routes requests to active servers.

    Try it Yourself:

    1. Select Server 1 in the graph canvas.

    2. Under ⚙️ Configure Node, set its Connections Capacity to 0.

    3. Press Play or click Reset & Play to run.

    4. Observe how the load balancer skips Server 1 entirely and balances traffic only between Server 2 and Server 3!

    Running1/0

    No frames available