How do I distribute load proportionally across servers with different capacities?
Short answer
Each Backend Service is given a Weight proportional to its capacity, and an algorithm that uses Weight is selected on the vService; the most common one is Weighted Round Robin (three servers with Weights of 4, 2 and 1 receive approximately 57%, 29% and 14% of the traffic). Least Connection, Random, Least Response Time and Least Bandwidth also take Weight into account. Connection Limit puts a hard ceiling on the weak server, and the First algorithm fills the servers in order. Since the default Round Robin ignores Weight, entering only Weight is not enough.
Problem: The Servers Are Not Equally Powerful
In server farms, servers with different hardware exist together: new and powerful servers run alongside older ones, or a server is shared with other workloads. If traffic is split equally, the weak server slows down and the capacity of the powerful server is wasted. In TR7, Round Robin, the default algorithm, ignores the Weight values; even if Weight is entered, the distribution stays equal unless the algorithm is changed.
Solution: Five Methods
The methods are alternatives to one another; Method 2 (Connection Limit) can also be used together with the others.
| Your situation | Suitable method |
|---|---|
| HTTP or L7 TCP; the share of the servers should be proportional to capacity | Method 1: Weight + an Algorithm That Uses Weight |
| A hard upper limit should be placed on the number of concurrent connections of the weak server | Method 2: Connection Limit |
| Instead of a ratio, the servers should be filled in order and the extra servers should stay idle | Method 3: First + Connection Limit |
| Network vService | Method 4: Weighted Round-Robin / Weighted Least-Connection on the Network vService |
| The settings should be made from the command line | Method 5: WEB-CLI |
Method 1: Weight + an Algorithm That Uses Weight Recommended
- How it works The Weight of each server determines its share (share = Weight ÷ total Weight). The selected algorithm incorporates Weight into its own criterion: Weighted Round Robin distributes in turn, Least Connection by proportioning the open connection count to Weight, Random by drawing candidates in proportion to Weight, and Least Response Time and Least Bandwidth by dividing the criterion by Weight.
- Where it is openedLoad Balancer → Backend Services → Details → Weight; vService → Details → LB Algorithm → Algorithm
- Requirement A Weight value for each Backend Service (1–256; default 1 if left empty)
- vService type HTTP, L7 TCP
- Backend Service side No change is required on the servers.
| Algorithm | When |
|---|---|
| Weighted Round Robin | Short, similar requests; a fixed ratio is sufficient |
| Least Connection | Long or variable-duration connections |
| Random | Large or frequently scaled server pool |
| Least Response Time / Least Bandwidth | The response speed or bandwidth of the servers is decisive; applied as Least Connection if the Core Engine version of the vService does not support it |
Step-by-Step Configuration
The ratio is determined according to the capacity of the servers (e.g. the number of cores or the requests/second measured with a load test): 4 for the powerful server, 2 for the medium server, 1 for the weak server.
The Load Balancer → Backend Services steps are followed, the Backend Service is selected from the list and the Edit button is clicked. If a Backend Group is used, the group is opened for editing in the same way on the Load Balancer → Backend Groups screen.
The Details switch in the form is turned on and a value is entered in the Weight field. In a Backend Group, the value is entered separately for each server row in the Backends table.
The Edit button at the bottom of the form is clicked. Steps 2–4 are repeated for each Backend Service.
The Load Balancer → Load Balancer vService List steps are followed, the vService is selected and the Edit button is clicked.
The Details switch at the top right of the form is turned on and the LB Algorithm box in the side panel is checked.
Weighted Round Robin (or an algorithm that uses Weight and suits the situation, from the table above) is selected from the Algorithm list. If Least Response Time is selected, the Time Metric field (default Total Time) opens; if Least Bandwidth is selected, the Bandwidth Window field (default 10 seconds) opens.
The Save button is clicked. The progress of applying the change is followed from the sync indicator at the bottom right of the screen. In a cluster setup, with the default auto-sync, the change is also sent to the peer device; if Manual Sync Mode is on, it is sent manually with Synchronize.
Verification
On the Live Stats screen of the vService, the request/connection counts in the Backend Services table and the W= suffix in the name cell are compared.
Distribution in proportion to Weight; W= suffixes match the entered valuesThe LB Algorithm section on the Load Balancer Management screen of the vService is read.
The name and description of the selected algorithmMethod 2: Connection Limit
- How it works A hard ceiling is put on the number of connections the Backend Service carries at the same time; when the limit is full, new connections go to the other servers in the same vService. It can be used together with any algorithm.
- Where it is openedLoad Balancer → Backend Services → Details → Connection Limit
- Requirement Knowing the number of concurrent connections the server can handle
- vService type All (on the Network vService, it is not applied if Protocol ANY - L3 is selected or Port Range is on)
- Backend Service side No change is required on the servers.
Step-by-Step Configuration
The number of concurrent connections the weak server can safely carry is determined.
The Load Balancer → Backend Services steps are followed, the Backend Service is selected and the Edit button is clicked.
The Details switch is turned on and a value (1–65535) is entered in the Connection Limit field. If the field is left empty, the number of connections is not limited.
The Edit button at the bottom of the form is clicked. On HTTP and L7 TCP vServices, if all the servers are at their limit, new requests wait in the queue; if the Queue Timeout (default 60 seconds) expires, the HTTP vService returns 503 to the client, and the L7 TCP vService closes the connection.
Verification
Under heavy traffic, the Current Sessions value of the server is monitored on the Live Stats screen of the vService.
Current Sessions ≤ Connection LimitMethod 3: First + Connection Limit
- How it works The first server in the list receives all the load until it reaches its Connection Limit, then the next one is used. It is an approach of filling in order, not a proportional one; Weight is not used.
- Where it is opened vService → Details → LB Algorithm → Algorithm → First
- Requirement A Connection Limit defined on each Backend Service
- vService type HTTP, L7 TCP
- Backend Service side No change is required on the servers.
Step-by-Step Configuration
Each Backend Service is given a Connection Limit according to its capacity, as in Method 2: a high value for the powerful server, a low value for the weak server. A server with no limit entered has no ceiling; if the first server has no limit, all traffic stays on that server.
The Load Balancer → Load Balancer vService List steps are followed, the vService is selected and the Edit button is clicked.
The Details switch at the top right of the form is turned on and the LB Algorithm box in the side panel is checked.
First is selected from the Algorithm list.
The Save button is clicked.
Verification
In Live Stats, it is seen that no sessions go to the other servers before the first server reaches its limit.
The servers fill up in orderMethod 4: Weighted Round-Robin / Weighted Least-Connection on the Network vService
- How it works On the Network vService, proportional distribution according to Weight is done with Weighted Round-Robin or Weighted Least-Connection (Locality-Based Least-Connection and Source Hash also take Weight into account). No new connection is sent to a server whose Connection Limit is full.
- Where it is opened Network vService → Details → LB Algorithm
- Requirement A Weight value for each Backend Service
- vService type Network
- Backend Service side No change is required apart from the requirements of the selected LB Mode.
Step-by-Step Configuration
The Backend Services are given a Weight proportional to capacity, as in steps 1–4 of Method 1.
The Load Balancer → Load Balancer vService List steps are followed, the Network vService is selected and the Edit button is clicked.
The Details switch at the top right of the form is turned on and the LB Algorithm box in the side panel is checked.
Weighted Round-Robin or Weighted Least-Connection is selected from the algorithm list. Weighted Least-Connection is listed only while the Protocol is TCP - L4 or UDP - L4. If Protocol ANY - L3 is selected or Port Range is on, only Weighted Round-Robin applies Weight, and the Connection Limit is not used.
The Save button is clicked. On the Network vService, every save restarts the vService (Network vService · Save); the change is made at a low-traffic time.
Verification
The New Connection/s values of the Backend Services are compared on the Live Stats screen of the vService.
Connections in proportion to WeightMethod 5: WEB-CLI
- How it works Weight, Connection Limit and the algorithm are written from the command line.
- Where it is openedWEB-CLI →
lb backend update/lb service update - Requirement WEB-CLI access; Backend Service and vService IDs (seen with
lb backend listandlb service list) - vService type All
Step-by-Step Configuration
The Weight and Connection Limit are written for each Backend Service; the ID of the Backend Service is written in place of <backend>:
lb backend update id <backend> --weight 4 --connLimit 2000On HTTP and L7 TCP vServices, an algorithm that uses Weight is written in the --algorithm field. roundrobin is Weighted Round Robin (the version without Weight is roundrobinNoWeight):
lb service update id <vService> --algorithm roundrobinOn the Network vService, wrr (Weighted Round-Robin) or wlc (Weighted Least-Connection) is written in the --l4Algorithm field:
lb service update id <vService> --l4Algorithm wrrVerification
The Backend Service record is displayed.
lb backend show <backend>The weight and connLimit fields match the entered valuesCommon Mistakes
- Entering Weight and leaving the algorithm at Round Robin. The default Round Robin ignores Weight; the distribution stays equal.
- Thinking
roundrobinin WEB-CLI is without Weight.roundrobinis Weighted Round Robin. - Expecting Weight with Fastest / Fastest+. These two algorithms do not look at Weight; they select the best server in the selected metric.
- Using First without a Connection Limit. Since the first server has no ceiling, all traffic stays on the first server.
- Entering 0 for Weight. The lowest value is 1; to take a server out of traffic, Maintenance Mode is used (Maintenance Mode does not apply to a Network vService; the Backend Service is removed from the vService's Backend Services list).
How it is done in the documentation
