How ELB Works
Overview

The following describes how ELB works:
- A client send requests to your application.
- Each listener added to your load balancer uses the protocol and port you have configured to receive the requests.
- The load balancer forwards requests.
- Each listener forwards the requests to the associated backend server group based on the routing rules you configure.
- If there are forwarding policies, each listener evaluates if incoming requests match any forwarding policy. If a match is found, the request is forwarded according to the forwarding action.
- Healthy backend servers in the backend server group receive the requests based on the load balancing algorithm and the routing rules you specify in the forwarding policy, handle the requests, and return results to the client.
How requests are routed depends on the load balancing algorithms configured for each backend server group. If the listener uses HTTP or HTTPS, how requests are routed also depends on the forwarding policies configured for the listener.
Load Balancing Algorithms
Dedicated load balancers support four load balancing algorithms: weighted round robin, weighted least connections, source IP hash, and connection ID.
Shared load balancers support weighted round robin, weighted least connections, and source IP hash.
Weighted Round Robin
Figure 2 shows an example of how requests are distributed using the weighted round robin algorithm. Two backend servers are in the same AZ and have the same weight, and each server receives the same proportion of requests.
Description |
Requests are routed to backend servers in sequence based on their weights. Backend servers with higher weights receive proportionately more requests, whereas equal-weighted servers receive the same number of requests. |
---|---|
When to Use |
This algorithm is typically used for short connections, such as HTTP connections.
|
Disadvantages |
|
Weighted Least Connections
Figure 3 shows an example of how requests are distributed using the weighted least connections algorithm. Two backend servers are in the same AZ and have the same weight, 100 connections have been established with backend server 01, and 50 connections have been established with backend server 02. New requests are preferentially routed to backend server 02.
Description |
Requests are routed to the server with the lowest connections-to-weight ratio. In addition to the number of connections, each server is assigned a weight based on its capacity. Requests are routed to the server with the lowest connections-to-weight ratio. |
---|---|
When to Use |
This algorithm is often used for persistent connections, such as connections to a database.
|
Disadvantages |
|
Source IP Hash
Figure 4 shows an example of how requests are distributed using the source IP hash algorithm. Two backend servers are in the same AZ and have the same weight. If backend server 01 has processed a request from IP address A, the load balancer will route new requests from IP address A to backend server 01.
Description |
The source IP hash algorithm calculates the source IP address of each request and routes requests from the same IP address to the same backend server. |
---|---|
When to Use |
This algorithm is often used for applications that need to maintain user sessions or state.
|
Disadvantages |
|
Connection ID
Figure 5 shows an example of how requests are distributed using the connection ID algorithm. Two backend servers are in the same AZ and have the same weight. If backend server 01 has processed a request from client A, the load balancer will route new requests from client A to backend server 01.
Description |
The connection ID algorithm calculates the QUIC connection ID and routes requests with the same hash value to the same backend server. A QUIC ID identifies a QUIC connection. This algorithm distributes requests by QUIC connection. You can use this algorithm to distribute requests only to QUIC backend server groups. |
---|---|
When to Use |
This algorithm is typically used for QUIC requests.
|
Disadvantages |
|
Factors Affecting Load Balancing
In addition to the load balancing algorithms, factors that affect load balancing include the connection type (persistent connection or short connection), session stickiness, and server performance and weights.
Assume that there are two backend servers with the same weight (not zero), the weighted least connections algorithm is selected, sticky sessions are not enabled, and 100 connections have been established with backend server 01, and 50 connections with backend server 02.
When client A wants to access backend server 01, the load balancer establishes a persistent connection with backend server 01 and continuously routes requests from client A to backend server 01 before the persistent connection is disconnected. When other clients access backend servers, the load balancer routes the requests to backend server 02 using the weighted least connects algorithm.

If backend servers are declared unhealthy or their weights are set to 0, the load balancer will not route any request to the backend servers.
For details about the load balancing algorithms, see Load Balancing Algorithms.
If requests are not evenly routed, troubleshoot the issue by performing the operations described in How Do I Check Whether Traffic Is Evenly Distributed?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot