Difference between weight, current_weight, effective_weight, etc?

Pablo Fischer pablo at pablo.com.mx
Wed May 16 17:50:58 UTC 2018

Ahh, thanks a lot for the reference and sorry for the late reply, Maxim.

So reading that and assuming I’m already collecting via an OOB/async call
the weights of each server (the idea is to change the weights dynamically),
then when I notice a change in the weight of one of the peers the things I
should update are:

For round-robin:

 - the -> weight of the peer (I assume via get_peer): the new dynamic value.
 - The effective_weight: the new dynamic value.
 - Reset the current_weight to 0.
 - Update total_weights for the upstream group.

As for least conn, hash and others looks like we similar changes would also
be needed.

Am I a bit lost or in the right path? ;-D

On Mon, May 14, 2018 at 8:18 PM Maxim Dounin <mdounin at mdounin.ru> wrote:

> Hello!
> On Mon, May 14, 2018 at 08:04:22PM -0700, Pablo Fischer wrote:
> > We are looking (unless it already exists) to add load feedback
> > functionality to our setup, this basically means to have an API
> > (either lua or through C) that we can use to change the weight of
> > servers "dynamically" (either async or by hitting a specific URL).
> >
> > However when reading the code I'm a little confused on the difference
> > between those weight variables, seems that sometimes you compare them
> > against each other so not sure what is the difference in them.
> >
> > What is the difference between weight, current_weight and
> > effective_weight? I'm assuming that total_weight is the sum of all
> > weights (weight?) for a given upstream.
> Try reading this commit:
> http://hg.nginx.org/nginx/rev/c90801720a0c
> --
> Maxim Dounin
> http://mdounin.ru/
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20180516/93c47e4f/attachment.html>

More information about the nginx-devel mailing list