nginx upstream fair

Grzegorz Nosek grzegorz.nosek at
Thu Mar 11 11:47:38 MSK 2010

On śro, mar 10, 2010 at 10:05:40 -0500, izghitu wrote:
> Hi,
> I have latest nginx on a 64bit CentOS running.
> I use it as a load balancer in front of 2 apache servers.
> The upstream config is the following:
> upstream name {
>     fair;
>     server apache1;
>     server apache2;
> }
> server {
>   listen       nginx:80;
>   location / {
>     proxy_set_header Host $host;
>     proxy_set_header X-Real-IP $remote_addr;
>     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>     proxy_pass http://name;
>    }
> }
> My problem is that the server that I put at the bottom in the upstream conf gets a lot less connections then the server that is first. When load testing and sending lots of connections to the nginx server I can see from the nginx error_log that the connections to apache1 time out but it still tries to send new ones to it while the apache2 server has few connections with nginx and gets few new connections.
> If I change the order in the upstream then the problem still persists but with the other server.
> Am I doing something wrong?
> Please help.

Will try to reproduce it and get back to you. What kind of load are you
testing it with (approximate req/sec, reply size)?

upstream-fair does have a mode of operation which disables round-robin
behaviour but you're not using it here so it does look like a bug.

Best regards,
 Grzegorz Nosek

More information about the nginx mailing list