Skip to content

Commit

Permalink
dmq_usrloc: sync with multi contacts per message
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavanton committed Apr 3, 2017
1 parent 6d9e020 commit 75eee5f
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 63 deletions.
30 changes: 28 additions & 2 deletions src/modules/dmq_usrloc/README
Expand Up @@ -13,6 +13,13 @@ Andrey Rybkin
<rybkin.a@bks.tv>

Copyright © 2014

Edited by

Julien Chavanton, Flowroute
<jchavanton@gmail.com>

Copyright © 2017
__________________________________________________________________

Table of Contents
Expand All @@ -30,6 +37,7 @@ Andrey Rybkin
3.2. sync (int)
3.3. batch_size (int)
3.4. batch_usleep (int)
3.5. batch_msg_contacts (int)

4. usrloc_domain (string)

Expand All @@ -39,7 +47,8 @@ Andrey Rybkin
1.2. Set sync parameter
1.3. Set batch size parameter
1.4. Set batch_usleep parameter
1.5. Set usrloc_domain parameter
1.5. Set batch_msg_contacts parameter
1.6. Set usrloc_domain parameter

Chapter 1. Admin Guide

Expand All @@ -56,6 +65,7 @@ Chapter 1. Admin Guide
3.2. sync (int)
3.3. batch_size (int)
3.4. batch_usleep (int)
3.5. batch_msg_contacts (int)

4. usrloc_domain (string)

Expand All @@ -80,6 +90,7 @@ Chapter 1. Admin Guide
3.2. sync (int)
3.3. batch_size (int)
3.4. batch_usleep (int)
3.5. batch_msg_contacts (int)

3.1. enable (int)

Expand Down Expand Up @@ -140,13 +151,28 @@ modparam("dmq_usrloc", "batch_size", 4000)
modparam("dmq_usrloc", "batch_usleep", 1000)
...

3.5. batch_msg_contacts (int)

The parameter controls the amount of contact per message/transaction during a sync

Default value is 1.
Maximum value is 150.

Example 1.5. Set batch_msg_contacts parameter
...
modparam("dmq_usrloc", "batch_msg_contacts", 100) # 100 contacts / message
modparam("dmq_usrloc", "batch_size", 10000) # 10000 contacts / batch
modparam("dmq_usrloc", "batch_usleep", 500000) # one batch every 500ms
# syncing 20K contacts/second with 100 contacts/message
...

4. usrloc_domain (string)

The usrloc domain to synchronize.

Default value is “location”.

Example 1.5. Set usrloc_domain parameter
Example 1.6. Set usrloc_domain parameter
...
modparam("dmq_usrloc", "usrloc_domain", "my_domain")
...
7 changes: 7 additions & 0 deletions src/modules/dmq_usrloc/dmq_usrloc.c
Expand Up @@ -37,6 +37,7 @@ static int child_init(int);
int dmq_usrloc_enable = 0;
int _dmq_usrloc_sync = 1;
int _dmq_usrloc_batch_size = 0;
int _dmq_usrloc_batch_msg_contacts = 1;
int _dmq_usrloc_batch_usleep = 0;
str _dmq_usrloc_domain = str_init("location");

Expand All @@ -47,6 +48,7 @@ MODULE_VERSION
static param_export_t params[] = {
{"enable", INT_PARAM, &dmq_usrloc_enable},
{"sync", INT_PARAM, &_dmq_usrloc_sync},
{"batch_msg_contacts", INT_PARAM, &_dmq_usrloc_batch_msg_contacts},
{"batch_size", INT_PARAM, &_dmq_usrloc_batch_size},
{"batch_usleep", INT_PARAM, &_dmq_usrloc_batch_usleep},
{"usrloc_domain", PARAM_STR, &_dmq_usrloc_domain},
Expand Down Expand Up @@ -74,6 +76,11 @@ static int mod_init(void)
bind_usrloc_t bind_usrloc;
LM_INFO("dmq usrloc replication mode = %d\n", dmq_usrloc_enable);

if(_dmq_usrloc_batch_msg_contacts > 150) {
LM_ERR("batch_msg_contacts too high[%d] setting to [150]\n", _dmq_usrloc_batch_msg_contacts);
_dmq_usrloc_batch_msg_contacts = 150;
}

if (dmq_usrloc_enable) {

bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0);
Expand Down

0 comments on commit 75eee5f

Please sign in to comment.