[OpenSIPS-Devel] [opensips] load_balancer module enhancements (#345)

Sergey KHripchenko notifications at github.com
Mon Feb 2 15:28:58 CET 2015


i believe that one(or a few) malloc's is better than continuous locking.

in theory we also could soften (add a rounding) by a some (configurable) _factor_ to `it_l <=> load` equation to slightly move from load-based distribution to (pseudo-)equal-rate distribution (with`rand()`)

So what do you think about this commit?


P.S.
we also could use a trick to do something like this:
```cpp
static struct lb_dst **dsts;

struct lb_dst **dsts_cur;
struct lb_dst *dsts_tmp;

if ( (flags & LB_FLAGS_RANDOM) && (data->dst_no > 1) ) {
/* allocate space with pkg_realloc() in dsts */
dsts_cur = dsts;
} else {
dsts_cur = &dsts_tmp;
dsts_size_cur = 1;
}
```

so no malloc's happen when LB_FLAGS_RANDOM flag unset.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/345#issuecomment-72465761
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20150202/316b1dfe/attachment.htm>


More information about the Devel mailing list