How to Configure Auto-rebalance Using Avi CLI


The auto-rebalance feature helps in automatically migrating or scaling virtual services when the load on the Service Engines (SE) goes beyond or falls below the configured threshold. The following are few of the trigger types aggregated at an Avi Service Engine level:

  • Packets per second (PPS)
  • Throughput in Mbps
  • Open connections
  • CPU

The minimum and the maximum threshold is configured along with one of these options for the trigger type. By default, auto-rebalance is based on CPU trigger type.


Follow the steps given below to configure auto-rebalance feature on an Avi SE.

  1. Login to the Avi Controller CLI and enter the shell mode by using the shell command.

  2. On prompt, enter the Username and Password.

  3. Optionally, use the switchto command to switch to the respective tenant or cloud for which auto-rebalance can be configured.

     switchto tenant tenant-name 
     switchto cloud cloud-name 
  4. The auto_rebalance option is set to false. To enable it, login to the Avi Controller, bring up the shell, and set auto_rebalance to true.

    [admin:1-Controller-2]: > configure serviceenginegroup Default-Group
    [admin:1-Controller-2]: serviceenginegroup> auto_rebalance
    Overwriting the previously entered value for auto_rebalance
    [admin:1-Controller-2]: serviceenginegroup> save   
  5. Configure the auto-rebalance parameters using the following commands:

     configure serviceenginegroup Default-Group
     auto_rebalance_interval interval-value 
     auto_rebalance_criteria option
     auto_rebalance_capacity_per_se integer-value

    auto_rebalance_interval interval-value, provides the interval for which the auto-rebalance will be triggered on reaching the configured threshold. The interval-value is in seconds and the recommended value is 300s.

    Example: auto_rebalance_interval 300

    auto_rebalance_criteria option defines the auto-rebalance criteria. The options available are:

    • se_auto_rebalance_cpu
    • se_auto_rebalance_mbps
    • se_auto_rebalance_open_conns
    • se_auto_rebalance_pps

    Example: auto_rebalance_criteria se_auto_rebalance_cpu

    auto_rebalance_capacity_per_se integer-value defines the maximum allowed value for the specified criteria. For instance, the integer-value will be the maximum PPS in the case of se_auto_rebalance_pps and the maximum Mbps in the case of se_auto_rebalance_mbps.

    Example: auto_rebalance_capacity_per_se 200000

  6. Enter Save to save the configuration.

Configuring Auto-rebalance Threshold

The auto-rebalance threshold can be configured based on the SE group. You can use the following commands to configure the maximum and minimum threshold values per SE groups.

Note: The object used to configure thresholds is the same for all the trigger types (max_cpu_usage, min_cpu_usage) and is a part of the SE group configuration.

configure serviceenginegroup Default-Group
max_cpu_usage value
min_cpu_usage value

max_cpu_usage value, defines the maximum threshold value for CPU. The value is in percentage.

Example: max_cpu_usage 70

min_cpu_usage value, defines the minimum threshold value for CPU. The value is in percentage. Example: min_cpu_usage 30

Use Case Scenarios

This section covers two possible scenarios and the associated configuration.

Scenario 1: Auto-rebalance is based on PPS trigger, with a scale out threshold of 70% (of 200,000 PPS - i.e., when it exceeds 140,000 PPS) and a scale in the threshold of 30% (of 200,000 PPS - i.e., when it reduces below 60,000 PPS).

switchto tenant Avi
switchto cloud azure
configure serviceenginegroup Default-Group
auto_rebalance_interval 300
auto_rebalance_criteria se_auto_rebalance_pps
auto_rebalance_capacity_per_se 200000
max_cpu_usage 70
min_cpu_usage 30

Scenario 2: Auto-rebalance is based on open connection triggers, with a scale out threshold of 60% (of 5,000 connections per second - i.e., when it exceeds 3,000 connections per sec) and a scale in threshold of 20% (of 5,000 connections per second - i.e., when it reduces below 1,000 connections per sec).

switchto tenant Avi-azure
switchto cloud azure
configure serviceenginegroup Default-Group
auto_rebalance_interval 300
auto_rebalance_criteria se_auto_rebalance_open_conns
auto_rebalance_capacity_per_se 5000
max_cpu_usage 60
min_cpu_usage 20