Round-robin sends requests to servers in rotation. First request goes to server , second to server , third to server , then back to server .
The algorithm runs in time and uses space where is the number of servers.
function roundRobin(servers):
current = 0
while true:
server = servers[current]
current = (current + 1) mod servers.length
return server
Round-robin assumes all servers have equal capacity and all requests take equal time. When those assumptions hold, it works well.