How to Manage Load Balancing Algorithms on a Vultr Load Balancer

Updated on January 6, 2025

A load balancing algorithm determines how a Vultr Load Balancer distributes incoming traffic to linked instances. Vultr Load Balancers support the least connections and round robin algorithms that manage the distribution of traffic to instances depending on your application needs.

Follow this guide to manage load balancing algorithms on a Vultr Load Balancer using the Vultr Customer Portal, API, or CLI.

  • Vultr Customer Portal
  • Vultr API
  • Vultr CLI
  1. Navigate to Products and click Load Balancer.

  2. Click your target Load Balancer to open its management page.

  3. Click Configuration.

    Navigate to the Configuration Tab

  4. Click Load Balancer on the left navigation menu.

  5. Click the Algorithm drop-down and select a load balancing algorithm from the list of options.

    Field to select a Load Balancer algorithm

    • Round Robin: Distributes traffic evenly across all linked instances in a circular order.
    • Least Connections: Forwards traffic to the instance with the lowest number of active connections.
  6. Click Save Changes to apply the load balancing algorithm.

  1. Send a GET request to the List Load Balancer endpoint and note the target Load Balancer's ID.

    console
    $ curl "https://api.vultr.com/v2/load-balancers" \
        -X GET \
        -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  2. Send a PATCH request to the Update Load Balancer endpoint to update the target Load Balancer's algorithm.

    console
    $ curl "https://api.vultr.com/v2/load-balancers/<loadbalancer-id>" \
        -X PATCH \                                   
        -H "Authorization: Bearer ${VULTR_API_KEY}" \
        -H "Content-Type: application/json" \
        --data '{                           
            "balancing_algorithm": "<algorithm>"
    }'
    
  1. List all available instances and note the target Load Balancer's ID.

    console
    $ vultr-cli load-balancer list
    
  2. Update the target Load Balancer's algorithm.

    console
    $ vultr-cli load-balancer update <loadbalancer-id> --balancing-algorithm="leastconn"