Load Balancing allows you to define multiple backends with which to receive the traffic directed at your X4B Service. Load Balancing is supported for both the Layer 4 (TCP/UDP) and Layer 7 (HTTP/HTTPS).

Configure backend servers

  1. Open Services, choose the service's Action → Ports, then the port's Action → Load Balance. The configuration opens in a new tab.
  2. Select Enable Load Balancing. For HTTP/HTTPS, choose the Balancing Method, a common Backend Protocol, and DNS Cache Hosts when using hostname backends.
Load balancing enabled with Default method and HTTP backends
Choose a method compatible with backup servers; IP Hash cannot use backup peers.
  1. Review the existing backend row, then choose Add Backend for each additional independent origin. Enter its address and port, and Save. For example, use primary 200.1.1.1:80 and backup 200.1.1.2:80 with Default balancing, weight 1, Number of Failures 3, and Failure Timeout 30 seconds. Replace these example addresses with your origins.
  2. Reload and check both saved rows. Verify that each origin accepts X4B traffic and serves the intended application. Saving the pool does not establish origin reachability or prove failover.
Primary and backup backend addresses with failure thresholds
The backup serves requests when primary backends are unavailable. Two primary rows instead distribute normal traffic.

Changing a backend row requires Save. Its Action menu can reorder or delete it. Disabling load balancing returns the port to its simple backend configuration; check that destination in Ports before relying on it.

Load Balancing at Layer 7

Several methods are available for balancing connections to HTTP(s) services. All defined backends must be either HTTP or HTTPS.

Balancing methods

MethodHow connections are distributed
DefaultWeighted round-robin distribution
IP HashAttempts to route each client to a consistent server based on its IP address
Least ConnectionsRoutes the client to the server with the fewest active connections

DNS

A hostname backend can expand into several upstream addresses. DNS Cache Hosts limits the resolved addresses used for each hostname. The supported Dashboard range is 0 to 4. This setting controls an address count; DNS answer caching and refresh timing are separate.

ConfigurationEffect of DNS Cache Hosts
Simple hostname backend, value 0Uses cached DNS answers; opens a new backend connection per request
Simple hostname backend, value 1–4Uses up to that many addresses; supports keepalive
Load-balancing mode, value 0Uses one address per hostname; supports keepalive
Load-balancing mode, value 1–4Uses up to that many addresses per hostname; supports keepalive

Resolved addresses use the selected balancing method. For redundancy, use independent backend servers.

Refresh and keepalive

Addresses in the pool refresh in the background. Hostname backends currently resolve to IPv4 addresses, with DNS answers cached for five minutes. Allow for this cache lifetime when changing addresses.

Enable backend keepalive to reuse connections in an upstream pool. DNS refreshes update the available addresses while existing requests finish.

Initial lookup and DNS failures

The first request may be delayed while the backend hostname resolves. If no backend address becomes available in time, the request fails.

After a successful lookup, temporary DNS failures can leave previous addresses available while resolution is retried. A response saying the hostname does not exist (NXDOMAIN) removes the addresses for that hostname. Other configured backends may remain usable; if none can serve the request, the request fails.

See HTTP DNS backends for frontend/backend protocol distinctions and the NGINX upstream reference for balancing qualifications. Backup peers are incompatible with IP Hash; use a compatible method when configuring backups.

Options

OptionEffect
WeightWhere supported by the balancing method, higher values send more requests to this backend
Number of failures & Failure TimeoutTemporarily removes a backend from the pool after the configured number of failures
TypeUses backup backends when primary backends are offline

Statistics

Statistics are provided in regard to the distribution of requests between backends in total and for a 30 day period.

Load Balancing at Layer 4

Sessions are balanced in a round-robin manner with best effort fairness. In the context of TCP one session is one connection. In the context of UDP one session is one unique tuple (srcip,srcport,dstip,dstport) in this way it is much the same as TCP connection.

Layer 4 round-robin distribution does not provide the HTTP pool's failure-count and backup-server controls. For tunnel failover, see BGP tunnels.