# Fair Module

**URL:** <https://www.ruby-forum.com/t/fair-module/200972>\
**Category:** NGINX\
**Created:** [December 27, 2010, 9:07am UTC](https://www.ruby-forum.com/t/fair-module/200972 "2010-12-27T09:07:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikuSESS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f17d59/32.png) [@nikuSESS](https://www.ruby-forum.com/u/nikuSESS)\
**Post date:** [December 27, 2010, 9:07am UTC](https://www.ruby-forum.com/t/fair-module/200972/1 "2010-12-27T09:07:47Z")

</div>

Hello,

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

When we make a new setup to test the fair module it doesnt load balance.  
We  
are using the fair module in combination with ip hash to keep the  
sessions  
alive.

Weve 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?

Thank you

Grt  
Jaap

---

<div class="post-metadata">

**Author:** ![Jaap\_van\_Arragon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@Jaap\_van\_Arragon](https://www.ruby-forum.com/u/Jaap_van_Arragon)\
**Post date:** [December 27, 2010, 10:09am UTC](https://www.ruby-forum.com/t/fair-module/200972/2 "2010-12-27T10:09:16Z")

</div>

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.

> ```
> } #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 S. \< [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) \>
