Skip to main contentSkip to navigation
[email protected]
Client AreaSupport
Hosting Mammoth
HostingMammothYour Data, Our Responsibility
Home
Solutions
Hosting Services
Store
Pricing
About
Blog
API
Contact

Stay Ahead of the Curve

Get the latest insights on cybersecurity, AI innovations, and enterprise data solutions delivered to your inbox.

Hosting Mammoth
HostingMammothEnterprise Solutions

Enterprise-grade data solutions. Hosting, recovery, cybersecurity, and AI-powered services for businesses worldwide.

[email protected]
Sun - Fri, 9:00am - 5:00pm

Services

  • Cloud Hosting
  • Data Recovery
  • Cybersecurity
  • Legal Support
  • MSP Services
  • Web Development
  • AI Services
  • Free Server Migration

Hosting

  • VPS Hosting (NVMe SSD)
  • VDS Hosting (NVMe)
  • Storage VPS (High SSD)
  • GPU Servers
  • Managed Services
  • Cloud Firewall
  • Load Balancer
  • One-Click Apps
  • n8n Hosting
  • Object Storage
  • FAQ

Company

  • Store
  • Pricing
  • About Us
  • Locations
  • Blog
  • Testimonials
  • Contact
  • Affiliate Program
  • White-Label
  • Terms of Service
  • Privacy Policy
  • Browser Cookies
  • SLA

Support

  • Client Area
  • Submit Ticket
  • Knowledge Base
  • Server Status
  • API Documentation

© 2026 Hosting Mammoth. All rights reserved.

Knowledge Base
Getting StartedAccount ManagementVPS HostingGPU ServersStorage VPSCloud FirewallLoad BalancerServer ManagementBilling & PaymentsSupport & TicketsAffiliate ProgramReseller ProgramMarketplace & Appsn8n HostingManaged ServicesServer MigrationAPI & DevelopersSecurityTroubleshootingGlossaryInstall Guides
  1. Home
  2. /
  3. Support
  4. /
  5. Load Balancer
  6. /
  7. Load Balancer Algorithms
GUIDELoad Balancer

"Load Balancing Algorithms Explained"

7 min read

A load balancing algorithm determines how the load balancer distributes incoming requests across your backend servers. Choosing the right algorithm is important — it affects how evenly traffic is spread, how well your application handles different request types, and whether users maintain consistent connections to the same server.

This guide explains each algorithm, its strengths and weaknesses, and when to use it.

Round Robin

How It Works

Round Robin is the simplest algorithm. The load balancer sends each new request to the next server in a circular sequence:

  • Request 1 goes to Server A
  • Request 2 goes to Server B
  • Request 3 goes to Server C
  • Request 4 goes back to Server A
  • And so on...

Strengths

  • Simple and predictable. Easy to understand and debug.
  • Even distribution. Each server gets an equal share of requests (assuming all servers are the same).
  • No state required. The load balancer does not need to track active connections.
  • Low overhead. Minimal processing per request.

Weaknesses

  • Does not account for server load. If one request takes 10ms and another takes 10 seconds, servers handling slow requests accumulate more active work.
  • Assumes equal server capacity. If servers have different hardware specifications, the weaker server may become overloaded.

Best For

  • Web applications with fast, uniform request processing times.
  • Backend servers with identical hardware and capacity.
  • Stateless applications where any server can handle any request.

Weighted Round Robin

How It Works

An extension of Round Robin where each server has a weight that determines how many requests it receives relative to other servers.

For example, with weights of 3, 2, and 1:

  • Server A (weight 3) gets 3 out of every 6 requests.
  • Server B (weight 2) gets 2 out of every 6 requests.
  • Server C (weight 1) gets 1 out of every 6 requests.

Strengths

  • Accounts for servers with different capacities.
  • Allows gradual introduction of new servers (start with low weight).
  • Simple to configure.

Weaknesses

  • Same as Round Robin — does not account for actual server load.
  • Requires manual weight assignment and adjustment.

Best For

  • Environments with servers of different sizes (e.g., a mix of 4-core and 8-core VPS).
  • Gradually rolling out new servers (canary deployments).
  • Applications where you want proportional traffic distribution.

Least Connections

How It Works

The load balancer tracks the number of active connections to each backend server and sends each new request to the server with the fewest active connections.

If Server A has 10 active connections, Server B has 5, and Server C has 8, the next request goes to Server B.

Strengths

  • Adapts to server load. Servers handling slow requests naturally accumulate more connections, so they receive fewer new requests.
  • Better for variable request times. If some requests are fast and others are slow, Least Connections prevents slow-request servers from being overwhelmed.
  • Self-balancing. The algorithm automatically adjusts distribution based on real-time server load.

Weaknesses

  • Slightly more overhead. The load balancer must track connection counts in real time.
  • May not account for request complexity. A server with fewer connections might still be more loaded if its active requests are computationally expensive.

Best For

  • Applications with variable response times (some fast, some slow).
  • APIs with a mix of lightweight and heavyweight endpoints.
  • Long-lived connections (WebSocket, streaming).
  • Database-backed applications where query times vary.

Weighted Least Connections

How It Works

Combines Least Connections with server weights. The algorithm considers both the number of active connections and the server's weight when selecting the next server.

A higher-weight server can handle more connections before the algorithm stops sending it traffic.

Strengths

  • Accounts for both server capacity and current load.
  • Best balance for heterogeneous server environments.

Best For

  • Mixed server environments (different CPU, RAM, or network capacity).
  • Applications with variable request processing times and unequal servers.

IP Hash

How It Works

The load balancer computes a hash of the client's IP address and uses the result to consistently route that client to the same backend server. As long as the same set of servers is available, a client always reaches the same server.

Strengths

  • Session persistence without cookies. Users consistently reach the same server, maintaining server-side sessions without additional configuration.
  • No cookies needed. Works at the network level, so it functions for non-HTTP protocols too.
  • Simple implementation. No state tracking beyond the hash function.

Weaknesses

  • Uneven distribution. IP hashing does not guarantee even traffic distribution. Some hash buckets may receive more traffic than others.
  • Does not adapt to load. If one server is overloaded, IP Hash does not redirect its clients to other servers.
  • Disrupted by server changes. If you add or remove a backend server, the hash mapping changes and many users are reassigned to different servers.
  • Shared IPs. Users behind the same corporate NAT or proxy all have the same IP and will be routed to the same server.

Best For

  • Applications that require basic session persistence.
  • Non-HTTP protocols where cookie-based persistence is not an option.
  • Caching layers where you want each client to consistently hit the same cache.

Random

How It Works

The load balancer randomly selects a backend server for each request.

Strengths

  • Extremely simple.
  • Works well with large numbers of backend servers (random selection approaches even distribution with large sample sizes).

Weaknesses

  • Can produce temporarily uneven distribution, especially with few servers.
  • Does not adapt to server load or capacity.

Best For

  • Large pools of identical servers.
  • Workloads where occasional unevenness is acceptable.

Choosing the Right Algorithm

ScenarioRecommended Algorithm
Simple web application, identical serversRound Robin
Servers with different hardware specsWeighted Round Robin
Variable response times (APIs, dynamic content)Least Connections
Mixed servers and variable response timesWeighted Least Connections
Need basic session persistenceIP Hash
Large pool of identical serversRound Robin or Random
WebSocket or long-lived connectionsLeast Connections
Canary deployments / gradual rolloutsWeighted Round Robin

The Default Choice

If you are unsure, start with Round Robin if your servers are identical and your application is stateless. Switch to Least Connections if you notice uneven load or your application has variable response times.

Changing the Algorithm

You can change the load balancing algorithm at any time from your Data Mammoth dashboard:

  • Navigate to Network > Load Balancer.
  • Click on your load balancer.
  • Open the Settings or Configuration tab.
  • Select the desired algorithm.
  • Click Save.
  • The change takes effect immediately. Existing connections are not disrupted — the new algorithm applies to new incoming requests.

    Combining Algorithms with Other Features

    With Session Persistence

    If your application needs session persistence but you want good load distribution, use Least Connections or Round Robin with cookie-based sticky sessions instead of IP Hash. This gives you even distribution for new users while maintaining session consistency for returning users.

    With Health Checks

    All algorithms work with health checks. Regardless of the algorithm, unhealthy servers are removed from the pool and do not receive traffic. Configure health checks to ensure automatic failover. See Configuring Health Checks.

    What to Do Next

    • How to Set Up a Load Balancer — Create and configure your load balancer.
    • Configuring SSL with Your Load Balancer — Add HTTPS to your load-balanced setup.
    • Configuring Health Checks — Ensure automatic failover.
    • What Is a Load Balancer? — Review the fundamentals.

    Was this article helpful?

    ← Back to Load BalancerBrowse all categories →

    Still have questions?

    Contact Support →Submit a Ticket