Does order of servers in upstream directive matter ?

Igor Sysoev is at
Fri Sep 1 21:16:35 MSD 2006

On Fri, 1 Sep 2006, Yusuf Goolamabbas wrote:

>> From my reading of the upstream directive documentation (albeit via 
>> babelfish)
> I can't determine if the order of server names/IP in the upstream
> directive matter. does nginx balance the connections randomly
> (assuming no weight's are provided or is it round-robin)
> if I have 2 nginx instances should I keep
> server A;server B; in one instance and server B; server A in the other 
> instance

The requests are balanced in round-robin mode. If you have

  upstream one {
    server  A;
    server  B;
    server  C;

then 1st request goes to A, 2nd goes to B, 3rd goes to C, and
4th goes again to A.

If the 2nd request failed on upstream B, then it will be passed
  to the next upstream C. If it will failed on C too, then it will be
passed to A. If it will failed again, the failure will be reported
to a client.

Igor Sysoev

More information about the nginx mailing list