Skip to main content

Overview

UltraBalancer supports 7 algorithms. Choose based on your needs.

Algorithms

round-robin (default)

Even distribution across all backends.
ultrabalancer -a round-robin -b s1:8080 -b s2:8080
Best for: Similar backends, stateless apps

least-connections

Routes to backend with fewest active connections.
ultrabalancer -a least-connections -b s1:8080 -b s2:8080
Best for: Variable response times, long connections

ip-hash

Same client IP always goes to same backend.
ultrabalancer -a ip-hash -b s1:8080 -b s2:8080
Best for: Session affinity needed

random

Random backend selection.
ultrabalancer -a random -b s1:8080 -b s2:8080
Best for: Simple distribution, development

weighted

Higher weight = more requests.
ultrabalancer -a weighted -b s1:8080:200 -b s2:8080:100
Best for: Backends with different capacities

power-of-two

Picks 2 random backends, uses the one with fewer connections.
ultrabalancer -a power-of-two -b s1:8080 -b s2:8080 -b s3:8080
Best for: High performance, distributed choice

fastest-response

Routes to backend with fastest recent response.
ultrabalancer -a fastest-response -b s1:8080 -b s2:8080
Best for: Latency-sensitive applications

Quick Comparison

AlgorithmUse Case
round-robinDefault choice
least-connectionsLong requests
ip-hashSessions/sticky
weightedUnequal backends
power-of-twoPerformance
fastest-responseLatency-sensitive