[SR-Users] Weight balancing with dispatcher module
Ben Bliss
ben at enta.net
Mon Oct 19 12:07:55 CEST 2015
Hi Daniel,
Many thanks for taking the time to reply.
I have updated to 4.3.1, and am still having the same issue. However, I
have found a work around to the issue (or at least another way of doing
what i needed to do).
I plan to have a cluster of 5 or more media servers (only have 2 at the
moment, as I am still working through the kamailio/asterisk config) and
wanted to be able to force traffic through 1 media server for the sakes
of tracing and troubleshooting. The weighting method appeared to allow
me to do this. However, after reading through the dispatcher module
readme, I found the flags options will allow me to disable targets by
adjusting the flags within the database.
For reasons I don't fully understand, when set to 50/50, 60/40 etc. the
balancing appears to work fine. Its only when you set it the targets to
100/0 things start to go awry, but the only reason to do this was to
send all traffic to one destination. As setting the flag to 4 against
the target disables routing to it, I can leave the weighting alone, and
just adjust the flag values as and when needed.
Kind Regards,
---------
Ben Bliss
On 16/10/2015 3:26 PM, Daniel-Constantin Mierla wrote:
> Hello,
>
> can try with latest version in 4.2 series? There was a fix to weight
> based balancing quite some time ago, but it might be after 4.2.4 was
> released.
>
> Cheers,
> Daniel
>
> On 15/10/15 18:11, Ben Bliss wrote:
>> Hi,
>>
>> I am having issues getting the dispatcher to work using weighting. I
>> have been digging through old posts to the list, and tried all that I
>> have found, but am still having no luck at all.
>>
>> So, information...
>>
>> version: kamailio 4.2.4 (amd64/freebsd) be62bd
>> flags: STATS: Off, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS,
>> DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC,
>> F_MALLOC, DBG_F_MALLOC, USE_PTHREAD_MUTEX, USE_DNS_CACHE,
>> USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
>> MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024,
>> BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
>> poll method support: poll, select, kqueue.
>> id: be62bd
>>
>> Dispatcher configuration...
>>
>> modparam("dispatcher", "db_url", DBURL)
>> modparam("dispatcher", "table_name", "dispatcher")
>> modparam("dispatcher", "flags", 3)
>> modparam("dispatcher", "force_dst", 1)
>> modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
>> modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
>> modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
>>
>> Dialplan config..
>>
>> route[DISPATCH] {
>> if(!ds_select_dst("1", "9"))
>> {
>> send_reply("404", "No destination");
>> exit;
>> }
>> xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n");
>> t_on_failure("RTF_DISPATCH");
>> return;
>>
>> I am loading the values from a database, which are being loaded fine,
>> and appear to be being formatted correctly aswell..
>>
>> +----+-------+-------------------------+-------+----------+------------+----------------------+
>>
>> | id | setid | destination | flags | priority | attrs
>> | description |
>> +----+-------+-------------------------+-------+----------+------------+----------------------+
>>
>> | 1 | 1 | sipx.x.x.106:5060 | 8 | 1 | weight=100 |
>> |
>> | 2 | 1 | sip:x.x.x.107:5060 | 8 | 1 | weight=0 |
>> |
>> +----+-------+-------------------------+-------+----------+------------+----------------------+
>>
>>
>> The IP's are public, so i've masked them... The following is from
>> kamcmd..
>>
>> {
>> NRSETS: 1
>> RECORDS: {
>> SET: {
>> ID: 1
>> TARGETS: {
>> DEST: {
>> URI: sip:x.x.x.107:5060
>> FLAGS: AP
>> PRIORITY: 1
>> ATTRS: {
>> BODY: weight=0
>> DUID:
>> MAXLOAD: 0
>> WEIGHT: 0
>> }
>> }
>> DEST: {
>> URI: sip:x.x.x106:5060
>> FLAGS: AP
>> PRIORITY: 1
>> ATTRS: {
>> BODY: weight=100
>> DUID:
>> MAXLOAD: 0
>> WEIGHT: 100
>> }
>> }
>> }
>> }
>> }
>> }
>>
>> However, when any call is placed, it will always goto the server
>> ending 107 (with weight 0, which means, as far as I understand, it
>> should be ignored). I've tried with ; after the weights, this made no
>> change either.
>>
>> When set to round robin, or via priority, it appears to work fine.
>>
>> Any ideas?
>>
More information about the sr-users
mailing list