Skip to main content

Load Balancing

FastGateway supports multiple load balancing algorithms through Default Traffic Policy.

Algorithms

AlgorithmDescription
Round RobinDistributes requests sequentially (default)
Least RequestRoutes to backend with fewest active requests
RandomRandomly selects a backend
Consistent HashRoutes same clients to same backends

Configuration Example

defaultTrafficPolicy:
loadBalancer:
type: "ConsistentHash"
consistentHash:
type: "Header"
header:
name: "X-User-ID"

Consistent Hash Options

Maintain session affinity using:

TypeDescription
HeaderHash based on request header value
CookieHash based on cookie value
SourceIPHash based on client IP address
consistentHash:
type: "Cookie"
cookie:
name: "session_id"
ttl: "3600s"

Consistent hashing ensures the same client reaches the same backend, useful for stateful applications and caching efficiency.