true load balancer

Tit Petric black at
Thu Jul 24 12:12:48 MSD 2008

mike wrote:
> On 7/23/08, Tit Petric <black at> wrote:
>> Currently, im going on the following assumptions:
>> 1. Have a HTTP command for reporting load of backend servers
>> 2. Have a HTTP command for moving a backend OFFLINE (for testing of load
>> balancing mostly, but i can see this beeing useful for maintainance)
>> 3. Have a HTTP command for moving a backend back ONLINE
> yes, having it be HTTP commands with a configurable user/password
> using http auth would be perfect and should minimize the amount of
> hacking required for that piece since nginx is already listening on
> the HTTP stream...
We agree, i wonder if we can use the existing access control (IP address 
and HTTP basic authentication) for this. If we can, super!
>> 4. Have a HTTP command for getting weight statistics (ie, load on all
>> backend servers, weights on all backend servers, other) for monitoring
>> (munin, ganglia, etc)
> Reporting would be great... knowing the number of connections
> currently active, maybe some average statistics, oh yeah - per Host:
> header bandwidth stats would be great for me personally (wishlist...)
>> I don't exactly know how we will invoke the real load balancer, but i
>> suppose it will be with the 'real;' keyword, like the fair load balancing
>> upstream wwwbackend {
>>     real;
>>     server earth     weight=20;
>>     server wind     weight=20;
>>     server water    weight=20;
>>     server fire        weight=20;
>> }
> What is the difference between "real" and current? Not sure I get it.
> Currently with nginx it will reproxy if it times out on one upstream
> which is awesome, so it already has more features than normal load
> balancers... it just doesn't have the capability to do healthchecking
> or work with a healthchecking system right now. Hopefully we can
> figure out a solution where people decide how they want to do their
> own healthchecking and simply launch
> http://localhost/nginx-config/earth/up or
> http://localhost/nginx-config/earth/down or some other very simple
> HTTP-request based thing. query strings or RESTful style... please
> nothing heavy and stupid like SOAP :)
Current (ie, normal weighted) doesn't take machine load into account, it 
just balances with the weights. Neither does fair, but it tries to 
approximate it. Real would collect load data, and adjust the weights 
accordingly, so the load will be evened out trough all servers.

You are correct in assuming or suggesting what you did, list items 2) 
and 3) above state just that, a way of taking a backend offline or back 
online from a previous offline command. This is in addition to the 
internal offline check (if the server becomes unreachable, nginx handles 
that already). We're not considering anything complex, but we will have 
a new HTTP method, like PURGE with ncache, so you won't be able to fuck 
things up with a normal browser (IE, Firefox).

Would you preffer to have GET requests for this? I guess we can set a 
location in the config (like /server-status, so each user can choose 
their own location for interfacing the load balancer)? I see some 
benefit in this, but mostly for statistics&status, I still think that 
load reporting from backend servers and taking a machine offline & 
online, needs to be a special HTTP command type.

More information about the nginx mailing list