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

Sergey KHripchenko notifications at github.com
Wed Oct 1 16:55:53 CEST 2014


Apparently, in its current implementation load_balancer module could be used in the only one way:

load balance on static destinations group and static resources list.
first - because do_load_balance() ignores new group.
second - because do_load_balance() - clean up dialog profiles according to new resources string. not a previous one.

I tried to enhance this module to be able to use it in the following ways (this is just a sample to cover all possible cases):

route[LB1] {
      if( load_balancer("<ID_1>", "res1;res2") ) {
           t_on_failure("LB2_RETRY");
           route(RELAY);
       }
       route(LB2);
}
route[LB2] {
      if( load_balancer("<ID_1>", "res3") ) {
           t_on_failure("LB2_RETRY");
           route(RELAY);
       }
       route(LB3);
}
failure_route[LB2_RETRY] {
       route(LB2);
}
route[LB3] {
      if( load_balancer("<ID_2>", "res4") ) {
           t_on_failure("LB3_RETRY");
           route(RELAY);
       }
       route(FAILURE);
}
failure_route[LB3_RETRY] {
        route(LB3);
}

I also need to implement a scenario where I load-balance some amount of calls and reject excessive load, but some high-priority calls have to be handled at all cost. so I still want to load-balance them to select less busiest node, but ignore the fact that the amount of traffic on this node might exceed configured limits.

Also, if i register call as a 'load' using lb_count_call() function, I want to be able undo it.


You can merge this Pull Request by running:

  git pull https://github.com/shripchenko/opensips master

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/345

-- Commit Summary --

  * changed load_ballance() function to
  * add lb_reset() function to reset LB state in case you want to stop load-ballancing call
  * changed lb_count_call(ip,port,grp,resources[,mode]) function to allow one parameter
  * introduced two more algorithms for load_balance() that the same as existing, but

-- File Changes --

    M modules/load_balancer/lb_data.c (528)
    M modules/load_balancer/lb_data.h (11)
    M modules/load_balancer/load_balancer.c (40)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/345.patch
https://github.com/OpenSIPS/opensips/pull/345.diff

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


More information about the Devel mailing list