← Enterprise IT Networks Studio
βš–οΈ

Load Balancer Algorithm Visualizer

Round-robin, weighted round-robin, least-connections, and IP hash β€” same request stream, four outcomes

Each new request goes to the next server in strict rotation, ignoring load or weight.
πŸ–§
SRV-1
0
requests served
πŸ–§
SRV-2
0
requests served
πŸ–§
SRV-3
0
requests served
πŸ–§
SRV-4
0
requests served
Request Distribution (0 sent)
SRV-10 (0%)
SRV-20 (0%)
SRV-30 (0%)
SRV-40 (0%)
Recent Routing Decisions
Send a request to see routing decisions
Balance score: 100% (min served Γ· max served across servers β€” 100% is perfectly even). Round-robin and weighted round-robin balance by request count; least-connections and IP hash balance by a different criterion entirely, so an uneven score is not necessarily wrong for those algorithms.
When to Use Each Algorithm
Round-Robin
Uniform servers, stateless requests, simplest to configure.
Weighted Round-Robin
Mixed server capacity β€” send more traffic to bigger boxes.
Least-Connections
Long-lived or variable-duration connections (e.g., WebSockets, DB pools).
IP Hash
Session affinity ("sticky sessions") without a shared session store.

About the Load Balancer Algorithm Visualizer

This simulator sends the same stream of synthetic client requests through four different load-balancing algorithms β€” round-robin, weighted round-robin, least-connections, and IP hash β€” so you can directly compare how each one distributes traffic across a pool of backend servers. Send single requests or a burst of ten and watch the distribution chart and routing log update in real time.

Round-robin and weighted round-robin

Round-robin is the simplest load-balancing algorithm: each new request is sent to the next server in a fixed rotation, cycling back to the first server after reaching the last. It works well when every backend server has roughly equal capacity and requests are short-lived and stateless. Weighted round-robin extends this by assigning each server an integer weight reflecting its relative capacity β€” a server with weight 3 receives three times as many requests as a server with weight 1 over the long run, using a smooth interleaving (as modeled here) rather than sending all of one server's share consecutively.

Least-connections

Least-connections routes each new request to whichever backend server currently has the fewest active connections, rather than following a fixed rotation. This adapts naturally to servers with different processing speeds or requests with widely varying durations β€” a server that is slow to finish its current work accumulates connections and receives fewer new ones until it catches up. It requires the load balancer to track live connection counts per server, which is more state than round-robin needs but is standard in modern Layer 4/7 load balancers (NGINX, HAProxy, AWS ALB/NLB).

IP hash and session affinity

IP hash computes a hash of the client's source IP address (sometimes combined with the destination port) and uses the result to consistently select the same backend server for that client on every request β€” this is a form of session affinity ("sticky sessions") that works without needing a shared session store between servers. Its main drawback is uneven distribution if client IPs are not well spread (e.g., many users behind the same corporate NAT all hash to one server) and reduced flexibility if that server needs to be taken out of rotation, since evicting it changes the hash mapping for many clients at once.

Frequently asked questions

Which load-balancing algorithm is "best"?

There is no universally best algorithm β€” the right choice depends on whether your backend servers are homogeneous or not (favor weighted round-robin if not), whether requests are short and stateless or long-lived (favor least-connections for long-lived), and whether you need session affinity without shared session storage (favor IP hash or a cookie-based alternative).

What is the difference between Layer 4 and Layer 7 load balancing?

A Layer 4 load balancer makes routing decisions based on IP address and TCP/UDP port only, without inspecting application data β€” fast and protocol-agnostic. A Layer 7 load balancer inspects the actual HTTP request (URL path, headers, cookies) to make smarter routing decisions, such as routing /api requests to one server pool and /static requests to another, at the cost of more processing overhead.

How does a load balancer know if a server is unhealthy?

Health checks β€” periodic synthetic requests (e.g., an HTTP GET to /health) sent to each backend server. A server that fails a configurable number of consecutive health checks is automatically removed from the active pool until it passes checks again, preventing the load balancer from routing real traffic to a down or degraded server.

Can these algorithms be combined?

Yes β€” many production load balancers support a two-tier approach, such as weighted least-connections (combining server capacity weighting with live connection tracking) or consistent hashing with virtual nodes (which reduces the redistribution problem that plain IP hash has when the server pool changes size).

πŸŽ“

Try our Enterprise IT Networks Studio

More calculators, simulators, and guides for this discipline.

Related tools & guides

Network Topology & Redundancy Simulator β†’Bandwidth & QoS Congestion Simulator β†’Network Redundancy & Uptime Calculator β†’IP Network Modeling Lab β†’