Module: sip-router
Branch: master
Commit: 3bb02db14ed4861e1c30422ba26204f2ac233dee
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3bb02db…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Fri Mar 30 12:48:33 2012 +0100
modules_k/rls: RLS NOTIFY requests now trickled out instead of in one big batch on timeout
- New modparam: notifier_poll_rate (default 10 per second) can be
used to set how often the notifier process should check for work.
Each time the notifier process does something it should send (if
the hash works evenly) 1/(waitn_time * notifier_poll_rate) sets
of RLS NOTIFY requests.
- RLS NOTIFY requests will still come out within waitn_time seconds of
the back-end NOTIFY.
- Corrected the the default value of waitn_time. It is now 5 seconds
which matches the documentation and the RFC.
- Fixed a whitespace/indentation inconsistency and a typo in one of the
diagnostic messages.
---
modules_k/rls/README | 190 +++++++++++++++++++++------------------
modules_k/rls/doc/rls_admin.xml | 30 ++++++-
modules_k/rls/resource_notify.c | 8 ++-
modules_k/rls/rls.c | 80 ++++++++++-------
modules_k/rls/rls.h | 1 +
5 files changed, 187 insertions(+), 122 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=3bb…
Module: sip-router
Branch: master
Commit: 86646d0d512be27b61a821f297aba53178563e2b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=86646d0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Mar 30 13:24:03 2012 +0200
dispatcher(k): removed constraint for ds_reload and alg 10
- ds_reload can be executed even when using call load distribution
- old list of active calls is destroyed, the module starts counting from
0 with the next new call calls
---
modules_k/dispatcher/README | 8 +++---
modules_k/dispatcher/dispatch.c | 15 +++++++++----
modules_k/dispatcher/dispatcher.c | 6 -----
modules_k/dispatcher/doc/dispatcher_admin.xml | 9 ++++---
modules_k/dispatcher/ds_ht.c | 26 +++++++++++++++++++++++++
modules_k/dispatcher/ds_ht.h | 1 +
6 files changed, 46 insertions(+), 19 deletions(-)
diff --git a/modules_k/dispatcher/README b/modules_k/dispatcher/README
index cffcc6d..e68a2a8 100644
--- a/modules_k/dispatcher/README
+++ b/modules_k/dispatcher/README
@@ -909,10 +909,10 @@ onreply_route {
5.3. ds_reload
- It reloads the groups and included destinations. The command is
- disabled for call load based dispatching (algorithm 10) since removal
- of destinations may leave the list of active calls with broken
- references.
+ It reloads the groups and included destinations. For algorithm 10 (call
+ load distribution), old internal list of active calls is destroyed
+ (because it is bould to the previous list of gateways), meaning that
+ the module is starting to count active calls again from 0.
Name: ds_reload
diff --git a/modules_k/dispatcher/dispatch.c b/modules_k/dispatcher/dispatch.c
index 2196992..ae0c51b 100644
--- a/modules_k/dispatcher/dispatch.c
+++ b/modules_k/dispatcher/dispatch.c
@@ -595,9 +595,10 @@ next_line:
fclose(f);
f = NULL;
- /* Update list */
+ /* Update list - should it be sync'ed? */
_ds_list_nr = setn;
*crt_idx = *next_idx;
+ ds_ht_clear_slots(_dsht_load);
ds_print_sets();
return 0;
@@ -774,9 +775,10 @@ int ds_load_db(void)
goto err2;
}
- /*update data*/
+ /* update data - should it be sync'ed? */
_ds_list_nr = setn;
*crt_idx = *next_idx;
+ ds_ht_clear_slots(_dsht_load);
ds_print_sets();
@@ -1327,7 +1329,8 @@ int ds_load_replace(struct sip_msg *msg, str *duid)
ds_unlock_cell(_dsht_load, &msg->callid->body);
ds_del_cell(_dsht_load, &msg->callid->body);
- idx->dlist[olddst].dload--;
+ if(idx->dlist[olddst].dload>0)
+ idx->dlist[olddst].dload--;
if(ds_load_add(msg, idx, set, newdst)<0)
{
@@ -1384,7 +1387,8 @@ int ds_load_remove(struct sip_msg *msg)
ds_unlock_cell(_dsht_load, &msg->callid->body);
ds_del_cell(_dsht_load, &msg->callid->body);
- idx->dlist[olddst].dload--;
+ if(idx->dlist[olddst].dload>0)
+ idx->dlist[olddst].dload--;
return 0;
}
@@ -1423,7 +1427,8 @@ int ds_load_remove_byid(int set, str *duid)
return -1;
}
- idx->dlist[olddst].dload--;
+ if(idx->dlist[olddst].dload>0)
+ idx->dlist[olddst].dload--;
return 0;
}
diff --git a/modules_k/dispatcher/dispatcher.c b/modules_k/dispatcher/dispatcher.c
index e376bb6..2ef1af4 100644
--- a/modules_k/dispatcher/dispatcher.c
+++ b/modules_k/dispatcher/dispatcher.c
@@ -772,12 +772,6 @@ static struct mi_root* ds_mi_list(struct mi_root* cmd_tree, void* param)
static struct mi_root* ds_mi_reload(struct mi_root* cmd_tree, void* param)
{
- if(dstid_avp_name.n!=0) {
- LM_ERR("No reload support when call load dispatching is enabled."
- " Do not set dstid_avp param if you do not use alg 10.\n");
- return init_mi_tree(500, MI_ERR_DSLOAD, MI_ERR_DSLOAD_LEN);
- }
-
if(!ds_db_url.s) {
if (ds_load_list(dslistfile)!=0)
return init_mi_tree(500, MI_ERR_RELOAD, MI_ERR_RELOAD_LEN);
diff --git a/modules_k/dispatcher/doc/dispatcher_admin.xml b/modules_k/dispatcher/doc/dispatcher_admin.xml
index 83f6c70..3453210 100644
--- a/modules_k/dispatcher/doc/dispatcher_admin.xml
+++ b/modules_k/dispatcher/doc/dispatcher_admin.xml
@@ -1111,10 +1111,11 @@ onreply_route {
<function moreinfo="none">ds_reload</function>
</title>
<para>
- It reloads the groups and included destinations. The command is
- disabled for call load based dispatching (algorithm 10) since
- removal of destinations may leave the list of active
- calls with broken references.
+ It reloads the groups and included destinations. For algorithm 10
+ (call load distribution), old internal list of active calls is
+ destroyed (because it is bould to the previous list of gateways),
+ meaning that the module is starting to count active calls again
+ from 0.
</para>
<para>
Name: <emphasis>ds_reload</emphasis>
diff --git a/modules_k/dispatcher/ds_ht.c b/modules_k/dispatcher/ds_ht.c
index 8322f50..1599fa4 100644
--- a/modules_k/dispatcher/ds_ht.c
+++ b/modules_k/dispatcher/ds_ht.c
@@ -149,6 +149,32 @@ int ds_ht_destroy(ds_ht_t *dsht)
return 0;
}
+int ds_ht_clear_slots(ds_ht_t *dsht)
+{
+ int i;
+ ds_cell_t *it, *it0;
+
+ if(dsht==NULL)
+ return -1;
+
+ for(i=0; i<dsht->htsize; i++)
+ {
+ lock_get(&dsht->entries[i].lock);
+ /* free entries */
+ it = dsht->entries[i].first;
+ while(it)
+ {
+ it0 = it;
+ it = it->next;
+ ds_cell_free(it0);
+ }
+ dsht->entries[i].first = NULL;
+ dsht->entries[i].esize = 0;
+ lock_destroy(&dsht->entries[i].lock);
+ }
+ return 0;
+}
+
int ds_add_cell(ds_ht_t *dsht, str *cid, str *duid, int dset)
{
diff --git a/modules_k/dispatcher/ds_ht.h b/modules_k/dispatcher/ds_ht.h
index f705889..8bfc02f 100644
--- a/modules_k/dispatcher/ds_ht.h
+++ b/modules_k/dispatcher/ds_ht.h
@@ -69,5 +69,6 @@ int ds_unlock_cell(ds_ht_t *dsht, str *cid);
int ds_ht_dbg(ds_ht_t *dsht);
int ds_cell_free(ds_cell_t *cell);
+int ds_ht_clear_slots(ds_ht_t *dsht);
#endif
Hello,
When under load RLS performs in a "lumpy" manner. I believe this is (at
least in part) because of the waitn_timer for sending NOTIFY requests.
This timer is needed because, as the RFCs point out, it is important to
buffer up RLS NOTIFY requests so as not to flood the network and client.
However, I was wondering if a small change might help smooth out the
lumps.
What I was thinking of is:
- Change the updated flag to be a number between 1 and the value of
waitn_time (0 means no update)
- Set the flag number based to the core_hash(did, NULL, waitn_time-1)+1
when the rls_presentity record is updated/inserted
- Have RLS NOTIFY requests sent each second. After the first second
records with the updated flag of value 1 are sent. After the second
second records with the updated flag of value 2 are sent. Wrapping back
to 1 after waitn_time seconds.
This should help smooth out the sending of NOTIFY requests from RLS while
still making sure they are buffered and take at most waitn_time seconds to
come out.
Can anybody see any reason why this won't work?
Would there be any objections to me making this change?
Regards,
Peter
--
Peter Dunkley
Technical Director
Crocodile RCS Ltd
Hello,
I generated alphabetic indexes for module parameters, functions, mi
commands and statistics:
- https://www.kamailio.org/wiki/start#alphabetic_indexes
If any of you find errors or missing items, report back to the lists.
A note for developers, if you have to use '[[' in the __title__ of the
sections for these components, add a space between them otherwise will
conflict with wiki syntax and break the indexing (such '[' is commonly
used for optional parameters).
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
http://www.asipto.com/index.php/kamailio-advanced-training/