Hello
On kamailio 1.5.2, I need to choose the gw from a group according to its weight. After trying unsuccessfully with different values I realized that the help guide says that the load_gw functions can return gateways according to "gateway's randomized weight within its group". So, I have these questions:
1- since it is "randomized", does this mean that the weight parameter actually can not guarantee that the weight value can decide how gateways are ordered? 2- once I have the gws on the avp, is it posible to re-order them? if so, how?
thank you very much
fborot
Fabian Borot writes:
1- since it is "randomized", does this mean that the weight parameter actually can not guarantee that the weight value can decide how gateways are ordered?
it is a randomized weight, not an absolute priority.
2- once I have the gws on the avp, is it posible to re-order them? if so, how?
you can re-order them by looping over the avps and copying/deleting/adding again, but i would not go though that much trouble. if you want a strict order, use gw priority instead (that exists at least in 3.1 and 3.2 versions of lcr module).
-- juha
Thanks Juha, I figured that the avp reordering would be something like that.
The help file for versions 3.1 and 3.2 also says "randomized weight", does it really work on those versions?
this is from 3.2
*********************** When the function load_gws() is called, matching gateways (that are not currently designated as defunct) are ordered for forwarding purposes as follows:
* (1) according to longest user part match * (2) according to tuple's priority * (3) according to tuple's randomized weight
**********************
or do you mean the "priority" column on the "lcr_rule_target" table instead?
This may be a dumb question but since I don't get it I have to ask: what is the purpose of the weight value then?
thank you fborot
From: fborot@hotmail.com To: users@lists.kamailio.org Subject: LCR weight parameter Date: Tue, 22 Nov 2011 06:39:44 -0500
Hello
On kamailio 1.5.2, I need to choose the gw from a group according to its weight. After trying unsuccessfully with different values I realized that the help guide says that the load_gw functions can return gateways according to "gateway's randomized weight within its group". So, I have these questions:
1- since it is "randomized", does this mean that the weight parameter actually can not guarantee that the weight value can decide how gateways are ordered? 2- once I have the gws on the avp, is it posible to re-order them? if so, how?
thank you very much
fborot
Fabian Borot writes:
The help file for versions 3.1 and 3.2 also says "randomized weight", does it really work on those versions?
yes it does.
or do you mean the "priority" column on the "lcr_rule_target" table instead?
yes.
This may be a dumb question but since I don't get it I have to ask: what is the purpose of the weight value then?
for example, you could have more than one gw serving the same destinations, but their capacity is different. by using weights, you can load balance calls to those gws so that each gets a portion of the calls that matches its capacity.
-- juha
thank you Juha, I understand the purpose and that is how I intend to use it, [more weights for gws with more capacity]
but I guess I should have rephrase my question as: what is the purpose of the "randomized" weight value then? when you randomize it then the weight parameter becomes useless.
example: 3 gws inside same group, and assuming the higher the weight the higher the capacity
gw 1 with weight 20 gw 2 with weight 30 gw 3 with weight 60
I would like to send more calls to gw 3, then gw 2 then gw 1 but if when I do a load_gws, and I randomize the weight (meaning I get a random value out of the possible 20, 30 and 60, then pick the gw with that random value, for example rand() returns 20, then I really obtain gw 2) then there is no guarantee that the order would be like I want it.
At least that is how I understand the "randomize" factor on this logic, do I get it wrong? If so please advise.
txs a lot
From: fborot@hotmail.com To: users@lists.kamailio.org Subject: RE: LCR weight parameter Date: Tue, 22 Nov 2011 07:33:23 -0500
Thanks Juha, I figured that the avp reordering would be something like that.
The help file for versions 3.1 and 3.2 also says "randomized weight", does it really work on those versions?
this is from 3.2
*********************** When the function load_gws() is called, matching gateways (that are not currently designated as defunct) are ordered for forwarding purposes as follows:
* (1) according to longest user part match * (2) according to tuple's priority * (3) according to tuple's randomized weight
**********************
or do you mean the "priority" column on the "lcr_rule_target" table instead?
This may be a dumb question but since I don't get it I have to ask: what is the purpose of the weight value then?
thank you fborot
From: fborot@hotmail.com To: users@lists.kamailio.org Subject: LCR weight parameter Date: Tue, 22 Nov 2011 06:39:44 -0500
Hello
On kamailio 1.5.2, I need to choose the gw from a group according to its weight. After trying unsuccessfully with different values I realized that the help guide says that the load_gw functions can return gateways according to "gateway's randomized weight within its group". So, I have these questions:
1- since it is "randomized", does this mean that the weight parameter actually can not guarantee that the weight value can decide how gateways are ordered? 2- once I have the gws on the avp, is it posible to re-order them? if so, how?
thank you very much
fborot
Fabian Borot writes:
3 gws inside same group, and assuming the higher the weight the higher the capacity
gw 1 with weight 20 gw 2 with weight 30 gw 3 with weight 60
I would like to send more calls to gw 3, then gw 2 then gw 1 but if when I do a load_gws, and I randomize the weight (meaning I get a random value out of the possible 20, 30 and 60, then pick the gw with that random value, for example rand() returns 20, then I really obtain gw 2) then there is no guarantee that the order would be like I want it.
At least that is how I understand the "randomize" factor on this logic, do I get it wrong? If so please advise.
if you have three gws with weights 1, 2, and 3 and you make many calls, then first gw will receive less of them as the second, and second less of them than the third. how much less, see this text in readme:
Weight is an integer value from 1 to 254. Weight implementation is fast, but unfair favoring larger weight values at the expense smaller ones. For example, if two gateways have weights 1 and 2, probability that the gateway with weight 1 is tried first is 1/4, not 1/3. Two scripts are provided in lcr/utils directory that can be used to check the probabilities resulting from a given set of weight values. Same can be done with command 'kamctl eval_weights'.
-- juha