Least connections sends each new request to the server currently handling the fewest active connections.
The algorithm tracks connection counts per server. When a new request arrives, it scans for the minimum. This takes time where is the server count. Space is for counters.
function leastConnections(servers):
minConnections = infinity
selected = null
for server in servers:
if server.connections < minConnections:
minConnections = server.connections
selected = server
return selected
This adapts better than round-robin when requests have varying processing times.