Algorithms

All load balancers utilize an algorithm that defines how traffic should be directed between back-end nodes. The default algorithm for newly created load balancers is RANDOM, which can be overridden at creation time or changed after the load balancer has been initially provisioned. The algorithm name is to be constant within a major revision of the load balancing API, though new algorithms may be created with a unique algorithm name within a given major revision of the service API.

Table. Load balancing algorithms

Name

Description

LEAST_CONNECTIONS

The node with the lowest number of connections receives requests.

RANDOM

Back-end servers are selected at random.

ROUND_ROBIN

Connections are routed to each of the back-end servers in turn.

WEIGHTED_LEAST_CONNECTIONS

Each request is assigned to a node based on the number of concurrent connections to the node and its weight.

WEIGHTED_ROUND_ROBIN

A round robin algorithm, but with different proportions of traffic beingdirected to the back-end nodes. Weights must be defined as part of the load balancer’s node configuration.

List load balancing algorithms

GET /v1.0/{account}/loadbalancers/algorithms

Lists all supported load balancing algorithms.

The following table shows the possible response codes for this operation:

Response Code

Name

Description

200

Success

Request succeeded.

400

Bad Request

The request is missing one or more elements, or the values of some elements are invalid.

401

Unauthorized

You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token.

404

Not Found

The requested item was not found.

413

Over Limit

The number of items returned is above the allowed limit.

422

ImmutableEntity

This fault is returned when a user attempts to modify an item that is not currently in a state that allows modification. For example, load balancers in a status of PENDING_UPDATE,BUILD, or DELETED may not be modified.

500

Load Balancer Fault

The load balancer has experienced a fault.

503

Service Unavailable

The service is not available.

Request

The following table shows the URI parameters for the request:

Name

Type

Description

{account}

String

The ID for the tenant or account in a multi- tenancy cloud.

This operation does not accept a request body.

Response

Example List load balancing algorithms: JSON response

{"algorithms": [
        {
            "name": "LEAST_CONNECTIONS"
        },
        {
            "name": "RANDOM"
        },
        {
            "name": "ROUND_ROBIN"
        },
        {
            "name": "WEIGHTED_LEAST_CONNECTIONS"
        },
        {
            "name": "WEIGHTED_ROUND_ROBIN"
        }
    ]
}

Example List load balancing algorithms: XML response

<algorithms xmlns="http://docs.openstack.org/loadbalancers/api/v1.0">
    <algorithm name="LEAST_CONNECTIONS" />
    <algorithm name="RANDOM" />
    <algorithm name="ROUND_ROBIN" />
    <algorithm name="WEIGHTED_LEAST_CONNECTIONS" />
    <algorithm name="WEIGHTED_ROUND_ROBIN" />
</algorithms>