Load balancing algorithms
The load balancing algorithm defines the criteria that the NetScaler appliance uses to select the service to which to redirect each client request. Different load balancing algorithms use different criteria. For example, the least connection algorithm selects the service with the fewest active connections, while the round robin algorithm maintains a running queue of active services, distributes each connection to the next service in the queue, and then sends that service to the end of the queue.
Some load balancing algorithms are best suited to handling traffic on websites, others to managing traffic to DNS servers, and others to handling complex web applications used in e-commerce or on company LANs or WANs. The following table lists each load balancing algorithm that the NetScaler appliance supports, with a brief description of how each operates.
| Name | Server selection based on |
|---|---|
| LEASTCONNECTION | Which service currently has the fewest client connections. This is the default load balancing algorithm. |
| ROUNDROBIN | Which service is at the top of a list of services. After that service is selected for a connection, it moves to the bottom of the list. |
| LEASTRESPONSETIME | Which load balanced server currently has the quickest response time. |
| URLHASH | A hash of the destination URL. |
| DOMAINHASH | A hash of the destination domain. |
| DESTINATIONIPHASH | A hash of the destination IP address. |
| SOURCEIPHASH | A hash of the source IP address. |
| SRCIPDESTIPHASH | A hash of the source and destination IP addresses. |
| CALLIDHASH | A hash of the call ID in the SIP header. |
| SRCIPSRCPORTHASH | A hash of the client's IP address and port. |
| LEASTBANDWIDTH | Which service currently has the fewest bandwidth constraints. |
| LEASTPACKETS | Which service currently is receiving the fewest packets. |
| CUSTOMLOAD | Data from a load monitor. |
| TOKEN | The configured token. |
| LRTM | Fewest active connections and the lowest average response time. |
| Static Proximity | The service that best matches the proximity criteria. |
| Least Request | Which service currently has the fewest client request. |
Depending on the protocol of the service that it is load balancing, the NetScaler appliance sets up each connection between client and server to last for a different time interval. This is called load balancing granularity, of which are three types: request-based, connection-based, and time-based granularity. The following table describes each type of granularity and when each is used.
| Granularity | Types of Load Balanced Service | Specifies |
|---|---|---|
| Request -based | HTTP or HTTPS | A new service is chosen for each HTTP request, independent of TCP connections. As with all HTTP requests, after the Web server fulfills the request, the connection is closed. |
| Connection-based | TCP and TCP-based protocols other than HTTP | A service is chosen for every new TCP connection. The connection persists until terminated by either the service or the client. |
| Time-based | UDP and other IP protocols | A new service is chosen for each UDP packet. Upon selection of a service, a session is created between the service and a client for a specified period. When the time expires, the session is deleted and a new service is chosen for any additional packets, even if those packets come from the same client. |
During startup of a virtual server, or whenever the state of a virtual server changes, the virtual server can initially use the round robin method to distribute the client requests among the physical servers. This type of distribution, referred to as startup round robin, helps prevent unnecessary load on a single server as the initial requests are served. After using the round robin method at the startup, the virtual server switches to the load balancing method specified on the virtual server.
The Startup RR Factor works in the following manner:
-
If the Startup RR Factor is set to zero, the appliance switches to the specified load balancing method depending on the request rate.
-
If the Startup RR Factor is any number other than zero, the appliance uses the round robin method for the specified number of requests before switching to the specified load balancing method.
-
By default, the Startup RR Factor is set to zero.
Note: You cannot set the startup RR Factor for an individual virtual server. The value you specify applies to all the virtual servers on the NetScaler appliance.
To set the startup round-robin factor by using the CLI
At the command prompt, type:
set lb parameter -startupRRFactor <positive_integer>
Example
set lb parameter -startupRRFactor 25000
To set the startup round-robin factor by using the GUI
-
Navigate to Traffic Management > Load Balancing > Configure Load Balancing Parameters, and set the Startup RR Factor.