The Decider said over 3 years ago permalink Comment? (0)
Tagged: nginx

Fair Balancing for nginx

If you have a busy server running multiple mongrels you probably have noticed how nginx will sometimes queue requests onto already busy mongrels while some mongrels are completely idle.

There is now a fair balancer plugin for nginx that makes it fair rather than round robin. It’s easy to install. Grab the the plugin here and grab the latest stable release of nginx (I’m using 0.7.6) from here

Follow the directions on github:

Installation:

You’ll need to re-compile Nginx from source to include this module.
Modify your compile of Nginx by adding the following directive
(modified to suit your path of course):

./configure —with-http_ssl_module —add-module=/absolute/path/to/nginx-upstream-fair make make install

Usage:

Change your Nginx config file’s upstream block to include the ‘fair’ directive:

upstream mongrel { fair; server 127.0.0.1:5000; server 127.0.0.1:5001; server 127.0.0.1:5002; }

Caution

One issue I ran into was having to change my nginx config files that contained false to off. For example:

proxy_redirect false;

now reads

proxy_redirect off;

Comments

simple_captcha.jpg
Are you a Human? Type the code above.