What is the First algorithm used for?
Short answer
First gives all the load to the first Backend Service in the list until that server's Connection Limit is reached; when the limit is reached, it moves to the next server. The goal is not to spread the load but to use the fewest servers: while traffic is low, only the first server works and the others stay idle. Weight is not used. If no connection limit is defined, the first server has no ceiling and all traffic goes to it as long as that server is running; the next server receives traffic only when the first server becomes disabled.
How Does It Work?
- A new request or connection goes to the first available server in the list. The order is the order of the Backend Services in the vService.
- When the concurrent connection count of the server reaches the Connection Limit, new connections go to the second server.
- If all servers are at their limit, new requests wait in the queue on HTTP and L7 TCP vServices; if the Queue Timeout (default 60 seconds) expires, the HTTP vService returns 503 to the client.
- When room opens up on the first server, new connections go to it again.
- A server that fails the health check or is in Maintenance Mode is skipped; traffic moves to the next server, and when the server comes back, new connections are directed to it again.
When Is It Used?
| Scenario | Why First |
|---|---|
| Keeping the number of servers or licenses to a minimum | While traffic is low, only the first server works |
| Shutting down extra servers during off-peak hours | The servers toward the end stay idle |
| Long-session services such as RDP and IMAP | Sessions settle in order without exceeding the full servers |
| Active-passive operation | If no Connection Limit is entered, all traffic goes to the first server; the next server takes effect only when the first server becomes disabled |
If the load is to be spread across the servers for short HTTP requests, Round Robin or Least Connection is selected instead of First.
In TR7
- Selection: vService → Details → LB Algorithm → Algorithm → First. The description in the interface: "The first server on the vService gets the load until it reaches maximum connections."
- Connection Limit: It is entered in the Details section of the Backend Service form (1–65535; if empty, there is no limit); in a Backend Group, it is entered separately for each server row (Backend Groups · Connection Limit).
- vService type: HTTP and L7 TCP; First does not exist on a Network vService.
- Alternative: Another way for active-passive is to define the standby server as a Backup Service; the Backup service does not receive traffic as long as the main servers are running.
Common Misconceptions
- "The servers fill up in order even without a Connection Limit." If there is no limit, the first server has no ceiling; it receives all the traffic.
- "Weight changes the order or the share." First ignores Weight.
- "First spreads the load across the servers." First fills the servers in order; Round Robin or Least Connection is used to spread the load.
How it is done in the documentation
