load balancing algorithms

Maxim Dounin mdounin at mdounin.ru
Tue Sep 26 00:40:10 UTC 2017


On Mon, Sep 25, 2017 at 03:11:36PM -0400, Adam Schwartz wrote:

> I’m Adam and I’ve been researching load balancing for my 
> undergraduate senior project. I’m particularly interested in the 
> behavior of the “power of two choices” and join-idle-queue 
> algorithms on Nginx.
> I’ve found that the `ngx_http_upstream_module` specifies a 
> `least_conn` and `least_time` load balancing method, but 
> otherwise incorporates round-robin.
> I was curious if the Nginx community had ever discussed 
> implementing other load balancing methods?

I don't remember more or less serious discussions at least 
since introduction of the least_conn and hash balancing methods.

On the other hand, there is API in nginx which allows to implement 
any load balancing algorithm needed.  And there are some 3rd party 
load balancing modules available.

As for the algorithms you've mentioned, "power of two choices" seems 
to be better than random, though it does not look like it is 
beneficial even compared to round-robin.  Something similar to 
join-idle-queue probably can be emulated by using least_time + 
max_conns=1 on each server + queue (though queue is only available 
in nginx-plus).

Maxim Dounin

More information about the nginx mailing list