maxconn 1 in nginx

Grzegorz Nosek grzegorz.nosek at gmail.com
Thu Oct 9 13:38:50 MSD 2008


On Thu, Oct 09, 2008 at 11:28:54AM +0200, Michał Jaszczyk wrote:
> Hey,
> 
> I'm creating a pretty big HTTP RESTful API that is organized in the
> following way: There are many different functionalities in the API.
> Different functionalities are served by different backend machines and
> each functionality is another smaller RESTful API. In front of all
> that mess I'd like to put Nginx. The idea is that Nginx would check
> the requested path and dispatch the request to proper backend, like
> this:
> - paths beginning with /some_path/... shoud be dispatched to
> backend-1.mydomain.com,
> - paths beginning with /other_path/.. shoud be dispatched do
> backend-2.mydomain.com,
> - etc.
> 
> So far everything can be done in Nginx easily. But: backends are
> written in Ruby on Rails and we all know how good HAProxy's "maxconn
> 1" is for Rails. How can I achieve the same in Nginx?

If I'm right about what maxconn=1 does, grab a fresh copy of upstream_fair
and set it up like this:

upstream foo {
 server 10.0.0.1:80 weight=1;
 server 10.0.0.2:80 weight=1;
 # etc.

 fair weight-mode=peak;
}

Weight=1 is the default but it's nice to make it explicit in this case.

...but give it a try with simple 'fair' (without parameters) too.

Best regards,
 Grzegorz Nosek





More information about the nginx mailing list