[OpenSIPS-Users] Opensips Dispatcher and PVAR pattern for load-balancing.

Răzvan Crainea razvan at opensips.org
Wed Dec 30 16:38:05 CET 2015


The weight mechanism does not work for this type of algorithm. However, 
you can simulate it - for example, for each destination, add a 
multiplier in the dispatcher's attribute field. The multiplier should be 
1, 2, 3, etc. When increasing the statistic, instead of increasing it 
with 1, you can increase it with that attribute. This way you can 
control how much traffic each destination will receive.

The load balance is always done equally, based on the statistic evaluation.

Best regards,
Răzvan

On 12/23/2015 06:59 PM, DHAVAL INDRODIYA wrote:
> Hi Razvan,
>
> Thanks for reply. I will test this on my script a quick question on 
> this is if we have multiple destinations how to define a weight of 
> each how dispatcher will take into considerations.
>
> Let say i have two destination and following entry in DB.
>
> ID    SOCKET               WEIGHT      PRIORITY
> ----------------------------------------------------------
> 1  sip:1.1.1.1:6060 <http://1.1.1.1:6060>        100            1
> 2  sip:2.2.2.2:6060 <http://2.2.2.2:6060>        200            2
> 3  sip:3.3.3.3:6060 <http://3.3.3.3:6060>        300            3
>
> How Load balance distribute a call let say we receive 10 cps ?
>
> Any help appreciated.
>
> Best Regards,
> Dhaval
>
> On Wed, Dec 23, 2015 at 7:24 PM, Răzvan Crainea <razvan at opensips.org 
> <mailto:razvan at opensips.org>> wrote:
>
>     Hi, Dhaval!
>
>     A use case for this algorithm is setting the pv_algo_pattern as
>     shown in the documentation page[1]:
>     modparam("dispatcher", "pvar_algo_pattern", "$stat(load_%u)")
>
>     This parameter indicates that whenever you are using a
>     ds_select_*() function with algorithm 9, OpenSIPS will check the
>     load for each destination, and order them based on each value.
>     For example, consider we have two destinations: sip:1.1.1.1 and
>     sip:2.2.2.2. Algorithm 9 will evaluate for each destination the
>     following pvars:
>     $stat(load_sip:1.1.1.1) and $stat(load_sip:2.2.2.2) and order them
>     based on its values. Then of course, first picks the least used one.
>
>     All that's left for you is to update the statistic accordingly.
>     For example:
>
>     if (ds_select_dst("0", "9"))
>         update_stat("load_sip:$dd", "+1");
>
>     Hope that's clear now.
>
>     [1]
>     http://www.opensips.org/html/docs/modules/2.1.x/dispatcher#id293975
>
>     Best regards,
>
>     Răzvan Crainea
>     OpenSIPS Solutions
>     www.opensips-solutions.com <http://www.opensips-solutions.com>
>
>     On 12/18/2015 01:05 PM, DHAVAL INDRODIYA wrote:
>>     Dear All,
>>
>>     I am working on opensips dispatcher and found that dispatcher is
>>     able to do loadbalancing in function ds_select_dst.
>>
>>     I have found a good description on DISPATCHER module itself it
>>     says  - " *The /pvar_algo_pattern/ parameter is used to determine
>>     the load on each server. If the parameter is not specified, then
>>     the first entry in the set is chosen.*"
>>
>>     Now the question here is how to use this load balancing and what
>>     should be exact value we need to put in pvar_algo_pattern?
>>
>>     How to define weight in table I mean what should be value of
>>     weight in table it is like number of call handling capability?
>>
>>     I have found some of the reference and that some how not working
>>     i might be using in wrong way if any one have a good example then
>>     would be a great help for me.
>>
>>     ​ BR,
>>     DI ​
>>
>>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> -- 
>
> Best Regards,
> *Dhaval Indrodiya
> *
> *skype: dki123sabse*
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-- 
Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20151230/f139d87e/attachment-0001.htm>


More information about the Users mailing list