On Sun, Jul 21, 2013 at 10:56:26PM +0800, Godbach wrote:
> On 2013-7-21 16:53, Willy Tarreau wrote:
> >Hi Godbach,
> >
> >I carefully checked and for me we can set SRV_UWGHT_MAX to SRV_UWGHT_RANGE.
> >It will have the effect of limiting the maximum number of servers a full
> >weight to 4095 instead of 4128 (so please update the doc for this). It is
> >also used in the leastconn algorithm, and similarly, the effective max
> >number of connections per server without overflowing will be limited to
> >1048575 instead of 1052688 (this is not a big issue).
> >
> >So yeah, please go ahead and send a fix for this by. Please also replace
> >4128 with 4095 in the documentation!
> >
> >
> 
> Hi Willy,
> 
> For roundrobin algo, the max mumber of servers is caculated by the formula
> 2^32/255^2/scale ~= 66051/scale
> 
> With scale is 16 and SRV_WGHT_MAX is 255, the result is 4128.
> 
> If SRV_WGHT_MAX is set to 256, the max number should be:
> 2^32/256^2/16 = 65536/16 = 4096
> 
> But you said this value should be 4095. I am confused by it.

Yes because the formula is wrong as well, in fact it was slightly
simplified in a way that didn't make any difference but now does.
2^32 is not allowed, it overflows, so the max product for computing
the position is ((2^32)-1)/(256^2)/16 = 4095.999999...

Don't worry, I'll update this in your patch. I'll merge them all
since it's the same functional change (with its propagation to the
doc), and we'd rather just pick one patch for the backports than
try to pick several related ones.

Thank you very much for doing this work. I don't know how's the whether
on your side but here it's been too hot to do anything productive during
the day :-)

Cheers,
Willy


Reply via email to