Chapter 3. Performance Tuning

Tunable parameters control how well the Network Load Balancing Software distributes outbound packets and how it balances inbound packets. This chapter describes these parameters in these sections:

Tuning Parameters

Network Load Balancing Software interface names are as follows:

nlb# lb0 lb1 ... 

The Network Load Balancing Software takes a rolling average of source and destination IP addresses and port numbers: after taking the first average, subsequent averages can be tuned, as explained in “Adjusting the Average Weight”. The software then applies a hash function and collapses the result to a 32-bit number so that it can send related packets out on the same interface.

The Network Load Balancing Software has tunable parameters for adjusting the hash function multiplier, number of devices to configure, and load balancing. Reset these parameters with systune; for information, see its man page, systune (1M).

The Network Load Balancing Software tunable parameters are as follows:

lb_hash_multiplier  


Hash function multiplier, which selects the output interface. The default multiplier is 612542337. For example:

systune lb_hash_multiplier 612542337 

lb_devices 

Maximum number of load-balancing devices to be configured when the system is booted. The default is 1; range is 1 to 10. This example configures the software for three active devices:

systune lb_devices 3 

For the new setting to take effect, reconfigure the kernel and reboot.

See “Network Load Balancing Software and the Shell Command File /etc/init.d/network” in Chapter 2 for information on setting the number of load-balancing devices.

lb_balance_period 


Period in milliseconds used for input load balancing. This variable determines how often the input-balancing algorithm is executed. The default is 1000 ms (that is, one second); the range is 100 to 600,000 ms. See “Adjusting the Balance Period” for instructions on adjusting this parameter.

lb_balance_thresh 


Threshold for mean deviation in input byte counts above which input load balancing is triggered. The balance period is set in milliseconds. See “Adjusting the Balance Threshold Value” for instructions on adjusting this parameter.

lb_average_weight  


Weighting in units of 100 used to calculate the rolling load averages for the interfaces. See “Adjusting the Average Weight” for instructions on adjusting this parameter.

Changing Input Load Balancing

The Network Load Balancing Software monitors packet count on the physical interfaces and reassigns clients depending on the load. The averages are calculated from the input packet counts for each interface. You can control this process by adjusting these parameters:

  • the balance period, which determines when the snapshot is taken for the rolling average

  • the threshold for mean deviation in input byte counts: this parameter determines when load balancing is triggered

  • the average weight used for calculating the rolling load averages for the interfaces

The rest of this section explains how to adjust these parameters.

Adjusting the Balance Period

The balance period determines how often the input-balancing algorithm is executed. More frequent execution increases overhead proportionally. The default is 1000 ms (that is, one second).

To reset the balance period, set lb_balance_period to the desired number of milliseconds (100 to 600,000); for example:

systune lb_balance_period 100000

Adjusting the Balance Threshold Value

The balance threshold value determines when load balancing is triggered; it is the threshold for mean deviation in input packet counts above which input load balancing is triggered. The Network Load Balancing Software calculates mean deviation, which should be less than the balance threshold.

When the mean absolute deviation, expressed as a percentage of the mean input load, exceeds this threshold, the Network Load Balancing Software attempts to balance the load by assigning a client another MAC address.

Setting the balance threshold value to a low number can result in a better input balance. However, such input balance might be impossible to achieve because the software continually moves clients from one MAC address to another.

The default balance threshold is 1%; the range is 1 to 100,000%. For example:

systune lb_balance_period 100 

Adjusting the Average Weight

The Network Load Balancing Software uses the following formula to calculate the rolling average:

where

and

S(n)  

The approximate average of n samples.

l(n)  

The nth sample.

k 

The tunable parameter, an integer that is the average weight. Default is 50; range is 0 to 99.

For example:

systune lb_average_weight 35 

If k is 0, S(n) is always l(n), the instantaneous load. As k increases, l(n) provides less and S(n-1) provides more of the value of S(n). The calculation uses k% of S(n-1) and 100-k% of l(n).