[sr-dev] [kamailio/kamailio] dispatcher algorithm 11, no more than 25 hosts in group for proper distribution (#2698)

Julien Chavanton notifications at github.com
Tue Mar 30 21:20:33 CEST 2021


good explanation from Daniel on the expected limitations :

```
Hello,

there was an issue on the tracker, but this looks like the redistribution due to percentage not being an integer number.  I referred to the docs (being noted there), closed the issue and pointed to sr-users for further discussions.

So, for example, if there are 30 routes each with rweight of 50, that means total rweight of 1500. With that, each route has the percentage of 50*100/1500=3.33, which is rounded to 3, meaning that each destination gets 3 calls in 100, total 90, with the last one (which can be the first in the dispatcher list file, depending on internal sorting and instert) getting the remaining 10, overall 13 go to this route (so 19 routes will get 3 calls, and 1 will get 13 calls). Now, depending on the number of routes, one of them may get a different value, but the fact is that if the percentage isn't an integer number, then the distribution is not equal for one of them. For example, with the 6 routes:

total rweight => 6 * 50 = 300; then percentage per route is 50*100/300 = 16.6, rounded to 16, meaning one will get 20.

You may want to do a double check of the rweight algorithm code, I haven't implemented it, but for weight the above remarks apply.

That was discussed in the past on the mailing list, and very likely it is not a bug also in this case, but how the distribution can be spread across 100 calls.

Even more, for r/weight algorithms, it really makes no sense to use them when there are so many routes with same weight, practically on more than 50, each one will get 1 call and the last in the memory least will get 51. So one gets more than 50% of the calls. From the other perspective, this is not even feasible to route to all of them in the same step, because by default kamailio can create 12 branches for a request, with a maximum configurable value of 31 (iirc). I think round robin or call load distribution is better for such large number of routes.

Cheers,
Daniel
```

We may be able to minimize the limitation of 100 slots be at least distributing the remainders.
```
/* if the array was not completely filled (i.e., the sum of rweights is
 * less than 100 due to truncated), then use last address to fill the rest */
last_insert = t > 0 ? dset->rwlist[t - 1] : (unsigned int)(dset->nr - 1);
for(j = t; j < 100; j++)
      dset->rwlist[j] = last_insert;
```



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2698#issuecomment-810516057
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20210330/a9a03c7c/attachment-0001.htm>


More information about the sr-dev mailing list