Fair Module

Piotr Sikora piotr.sikora at frickle.com
Mon Dec 27 12:08:08 MSK 2010

Fair ModuleHi,

> Is there a possibility to check if the HttpUpstreamFairModule is installed 
> right on our Nginx setup?

You can check compile-time options with "nginx -V". They should contain 
something like "--add-module=/path/to/fair" if you've got "upstream_fair" 
installed... But you've got it, otherwise nginx would complain about unknown 
"fair" directive.

> We are using the fair module in combination with ip hash to keep the 
> sessions alive.

You can't do that. Load balancers ("ip_hash" & "fair") are exclusive, so you 
can't combine them.

> We’ve tested it from several ip spaces but we always are thrown to the 
> same web server.
> Config upstream:
> upstream testvip {
>         fair default; #default weighted least-connection round robin
>         #ip_hash;
>         server xxx.xxx.xxx.xxx max_fails=5 fail_timeout=20s weight=3;
>         server xxx.xxx.xxx.xxx max_fails=5 fail_timeout=20s weight=1 ;
>     } #end upstream
> Any ideas?

I don't recall details (maybe Grzegorz will chime in), but I believe that 
"upstream_fair" will try to return idle backend before falling back to 
least-connection round robin, which means that in limited testing 
environment with single connection, you would be always redirected to your 
first backend.

Best regards,
Piotr Sikora < piotr.sikora at frickle.com >

More information about the nginx mailing list