---
title: Algorithms
url: https://docs.vultr.com/products/network/load-balancer/configuration/algorithms
description: Learn how to select and configure the traffic distribution methods for your Vultr Load Balancer
publish_date: 2024-09-23T20:20:55.443542Z
last_updated: 2026-05-26T19:55:49.035674Z
---

# How to Manage Load Balancing Algorithms on a Vultr Load Balancer

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 Console, API, CLI, or Terraform.

=== "Vultr Console"

    1. Navigate to **Products** and click **Load Balancers**.
    1. Click your target Load Balancer to open its management page.
    1. In **Details**, click the pencil icon to edit and manage the **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.
  
    1. Click **Save changes** to apply the Load Balancing algorithm.

=== "Vultr API"

    1. Send a `GET` request to the [**List Load Balancers** endpoint](https://www.vultr.com/api/#tag/load-balancer/operation/list-load-balancers) 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}"
        ```

    1. Send a `PATCH` request to the [**Update Load Balancer** endpoint](https://www.vultr.com/api/#tag/load-balancer/operation/update-load-balancer) to update the target Load Balancer's algorithm.

        ```console
        $ curl "https://api.vultr.com/v2/load-balancers/{load-balancer-id}" \
            -X PATCH \
            -H "Authorization: Bearer ${VULTR_API_KEY}" \
            -H "Content-Type: application/json" \
            --data '{                           
                "balancing_algorithm": "{roundrobin_or_leastconn}"
            }'
        ```

    1. Send a `GET` request to the [**Get Load Balancer** endpoint](https://www.vultr.com/api/#tag/load-balancer/operation/get-load-balancer) to fetch the details of the target Load Balancer.

        ```console
        $ curl "https://api.vultr.com/v2/load-balancers/{load-balancer-id}" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

=== "Vultr CLI"

    1. List all available instances and note the target Load Balancer's ID.

        ```console
        $ vultr-cli load-balancer list
        ```

    1. Update the target Load Balancer's algorithm.

        ```console
        $ vultr-cli load-balancer update <load-balancer-id> --balancing-algorithm "<roundrobin_or_leastconn>"
        ```

    1. Get the details of the target Load Balancer.

        ```console
        $ vultr-cli load-balancer get <load-balancer-id>
        ```

=== "Terraform"

    1. Open your Terraform configuration for the existing Load Balancer.

    1. Update the `balancing_algorithm` field in the configuration.

        ```terraform
        resource "vultr_load_balancer" "lb" {
            # ...existing fields (region, label, health_check, etc.)

            balancing_algorithm = "leastconn"
        }
        ```

    1. Apply the configuration and observe the following output:

        ```
        Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
        ```
