Skip to main content
Balancing modes and algorithms
Last update:

Balancing modes and algorithms

Balancing Modes

VMware NSX® Edge™ (Edge router) offers support for two balancer deployment modes: proxy mode (one-arm) and transparent mode (inline).

Proxy mode (one-arm)

When sending a request to one of the backends in proxy mode, the Edge uses its IP address as the source address — the balancer performs both Source and Destination NAT functions simultaneously. The backend sees all traffic as sent from the balancer and responds to it directly. In such a scheme, the balancer must be on the same network segment as the back-end servers.

The user sends a request to the VIP address (balancer address) that is configured on the Edge. Edge selects one of the backends and performs Destination NAT, replacing the VIP address with the address of the selected backend. Edge performs Source NAT, replacing the address of the requesting user with its own, and the packet is sent to the selected backend.

The backend does not respond directly to the user, but to Edge, as the original user address has been changed to the balancer address. Edge transmits the server's response to the user.

Transparent mode (inline)

In transparent mode, the balancer has interfaces on the internal and external network, but the internal network is not directly accessible from the external network. The built-in load balancer acts as a NAT gateway for virtual machines on the internal network.

The user sends a request to the VIP address (balancer address) that is configured on the Edge. Edge selects one of the backends and performs Destination NAT, replacing the VIP address with the address of the selected backend, and the packet is sent to the selected backend.

The backend receives the request with the user's original address (Source NAT was not performed) and responds to it directly. Traffic is again received by the load balancer, since in an inline scheme it usually acts as the default gateway for the server farm. Edge performs Source NAT to send traffic to the user using its VIP as the Source IP address.

Balancing algorithms

  • IP Hash — The server is selected based on the results of the hash function for the Source and Destination IP of each packet;
  • Least Connections — incoming connections are balanced based on the number of connections already available on a particular server. New connections will be directed to the server with the fewest connections;
  • Round Robin — new connections are sent to each server in turn according to the specified server weight;
  • URI — the left side of the URI (up to the question mark) is hashed and divided by the total weight of the servers in the pool. The result indicates which server is receiving the request. The request is directed to the same server as long as all servers remain available;
  • HTTP Header — balancing based on the HTTP header, which can be specified as a parameter. If the header is missing or does not have a value, the Round Robin algorithm is applied;
  • URL — in each HTTP GET request, the URL parameter specified as an argument is searched. If the parameter is followed by an equal sign and a value, the value is hashed and divided by the total weight of the running servers. The result indicates which server is receiving the request. This process is used to track user IDs in queries. The User ID is sent to the same server as long as all servers remain available.