When is Least Connection better than Round Robin?
Short answer
When connections last long or their durations differ greatly from one another. Round Robin sends a new connection to the server whose turn it is without looking at how busy the server is; therefore, long connections can pile up on one server. Least Connection, on the other hand, selects the server with the fewest open connections at that moment and balances the load according to the actual load of the servers. LDAP, SQL, WebSocket and large file transfers are typical examples; for short HTTP requests, Round Robin is sufficient.
How Does It Work?
- On each new connection, the current open connection counts of the servers are compared; the lowest one is selected. Among servers with the same load, distribution is done in turn.
- On HTTP and L7 TCP vServices, the Weight values of the Backend Services are taken into account: the connection count is proportioned to Weight, and the server with a higher Weight carries more connections.
- If a server slows down and its connections get longer, the open connection count increases; Least Connection directs new connections to the other servers.
Which One When?
| Situation | Suitable algorithm | Why |
|---|---|---|
| Short HTTP requests of similar duration | Round Robin / Weighted Round Robin | Connections close quickly; distribution in turn is balanced enough |
| Long-lived connections (LDAP, SQL, WebSocket) | Least Connection | Open connections pile up; the current load matters |
| Requests with highly variable durations (reports, file transfers) | Least Connection | Long jobs do not pile up on one server |
| The speeds of the servers differ | Least Connection or Least Response Time | The slow server receives fewer new connections |
The algorithm description in the interface also recommends Least Connection for servers with long session durations such as LDAP and SQL.
In TR7
- HTTP and L7 TCP: vService → Details → LB Algorithm → Least Connection.
- Network: Least-Connection or Weighted Least-Connection, which uses Weight; applied only in the TCP - L4 and UDP - L4 protocols, while Port Range is off (Network vService · Algorithms).
- Monitoring: On the Live Stats screen of the vService, the Current Sessions values of the Backend Services are compared.
Common Misconceptions
- "Least Connection is always better." For short HTTP requests, since connections close quickly, it does not provide a noticeable gain over Round Robin.
- "Least Connection ignores Weight." On HTTP and L7 TCP vServices, Weight is taken into account; on the Network vService, the version that uses Weight is Weighted Least-Connection.
- "Least Connection keeps the user on the same server." It does not provide persistence; if required, Persistence is selected separately.
- "On Network, Least-Connection also works while Port Range is on." While Port Range is on, distribution is done with Round-Robin.
How it is done in the documentation
