> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ibee.co.in/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ibee.co.in/docs/_mcp/server.

# Algorithms

> Choose how an IBEE Solutions load balancer distributes requests — round robin, least request, random, or consistent hash — and when to combine them with weights and sticky sessions.

The routing algorithm decides which backend receives each request. Set it as the **Routing algorithm** in the **Routing and health** section when you create a load balancer. Backend **weights** apply on top of every algorithm — a backend with weight `200` receives twice the share of one with weight `100`.

## Available algorithms

| Algorithm                                   | How it works                                                       | Best for                                                                   |
| ------------------------------------------- | ------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| **Round robin** (`round_robin`) *(default)* | Cycles through backends in order                                   | Evenly sized backends serving uniform requests                             |
| **Least request** (`least_request`)         | Sends each request to the backend with the fewest active requests  | Mixed request durations — keeps slow requests from piling onto one backend |
| **Random** (`random`)                       | Picks a backend at random                                          | Large backend pools where per-request state isn't worth tracking           |
| **Consistent hash** (`consistent_hash`)     | Hashes the request so the same client keys map to the same backend | Cache-friendly workloads where repeat hits should land on the same backend |

## Sticky sessions

On Layer 7 load balancers, enable **Sticky sessions** to pin a client to one backend across requests. Affinity is header-based: requests carrying the same value in the **Sticky header name** header (default `X-User-ID`) always route to the same backend.

Use sticky sessions when your application keeps per-user state in memory. Prefer stateless backends where possible — stickiness reduces how evenly load spreads.

## Weights

Every backend has a **Weight** from `1` to `1000` (default `100`). Use uneven weights to:

* Split traffic between versions (e.g. `90` / `10` canary)
* Send more traffic to larger instances in a mixed pool

Weights are set when you create the load balancer. A load balancer cannot be edited in place — to change weights, delete it and create a new one with the new values.

## Related pages

* [Create a load balancer](/docs/network-security/load-balancer/create-a-load-balancer)
* [Health checks](/docs/network-security/load-balancer/health-checks)
* [Attach VMs as backends](/docs/network-security/load-balancer/attach-vms)