Manual Chapter : BIG-IP 4.6 Features Guide:Node Counting Rule Function

Applies To:

Show Versions Show Versions

BIG-IP versions 1.x - 4.x

  • 4.6.0
Manual Chapter

3

Node Counting Rule Function


The active_nodes function

This version of the BIG-IP software includes a new rule function, active_nodes(), that you can use to select a pool based on how many nodes are available in that pool.

For a node to be considered available, it can not be forced down or marked down by a monitor. The node must also have a valid route, and must not have exceeded the connection limit configured for the node. If there are no nodes available in a pool, the active_nodes function returns a zero (0).

The active_nodes function is useful for configuring rules that load balance traffic according to the number of nodes that are available for load balancing on a server or group of servers. For instance, if you have traffic going to a pool on a local server and a certain number of the nodes on a server go down, traffic can be automatically sent to a pool in another data center.

To configure a rule to select a pool based on how many nodes are available in a pool, use the syntax shown in the example in Figure 3.1. The expression is indicated in boldface.


rule my_rule {
if (active_nodes (local_servers_pool) < 3) {
use pool remote_proxy_pool
}
else {
use pool local_servers_pool
}
}

Figure 3.1 Example of the active_node expression specified within a rule

In Figure 3.1, the element local_servers_pool is the variable operand. The element < is the relational operator, and the element active_nodes() is the function. The expression evaluates to the integer 3.

Note
If the <pool_name> specified does not exist, or when an invalid number of nodes is specified a rule, the active_nodes function returns a 0.


Configuring the active_nodes function in a rule

You can use the Configuration utility or the command line utility to create a rule that uses the active_nodes function. For information on how to create pools and other types of rules, see the BIG-IP Reference Guide.

To configure the active_nodes function using the Configuration utility

  1. In the navigation pane, click Rules.
    The Rules screen opens.
  2. Click the Add button.
    The Add Rule screen opens
  3. In the Name box, type a 1- to 31-character name.
  4. In the Type box, select Text Input. The Rule Builder does not support the active_nodes function.
    When you select Text Input, a screen displays in which you can type the complete text of your rule.
  5. When you have finished entering the rule, click Done.

To configure the active_nodes function from the command line

Syntax

The active_nodes() function takes the following argument:

active_nodes (<pool_name>)

where:

<pool_name> is the name of the target pool.

Example

This function is designed primarily to be used for directly selecting between pools. The following example of the active_nodes function returns a pool name:

bp rule <rule_name> {if (active_nodes (<pool1>) == 0) {use pool <pool2>} else {use pool <pool1>}}