Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dmq_usrloc: sync with multi contacts per message #1054

Merged
merged 2 commits into from Apr 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/modules/dmq_usrloc/dmq_usrloc.c
Expand Up @@ -37,6 +37,8 @@ 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_msg_size = 60000;
int _dmq_usrloc_batch_usleep = 0;
str _dmq_usrloc_domain = str_init("location");

Expand All @@ -47,6 +49,8 @@ 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_msg_size", INT_PARAM, &_dmq_usrloc_batch_msg_size},
{"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 +78,15 @@ 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_size > 60000) {
LM_ERR("batch_msg_size too high[%d] setting to [60000]\n", _dmq_usrloc_batch_msg_size);
_dmq_usrloc_batch_msg_size = 60000;
}
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
15 changes: 15 additions & 0 deletions src/modules/dmq_usrloc/doc/dmq_usrloc.xml
Expand Up @@ -39,6 +39,21 @@
<copyright>
<year>2014</year>
</copyright>
<editor>
<firstname>Julien</firstname>
<surname>Chavanton</surname>
<affiliation><orgname>flowroute.com</orgname></affiliation>
<email>jchavanton@gmail.com</email>
<address>
<otheraddr>
<ulink></ulink>
</otheraddr>
</address>
</editor>
</authorgroup>
<copyright>
<year>2017</year>
</copyright>
</bookinfo>
<toc></toc>

Expand Down
48 changes: 48 additions & 0 deletions src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml
Expand Up @@ -174,6 +174,54 @@ modparam("dmq_usrloc", "batch_size", 4000)
...
modparam("dmq_usrloc", "batch_usleep", 1000)
...
</programlisting>
</example>
</section>
<section id="usrloc_dmq.p.batch_msg_size">
<title><varname>batch_msg_size</varname> (int)</title>
<para>
The parameter controls the size of the messages during a sync
This is to make sure the messages are never larger then 65536 (the maximum datagram size)

Note that batch_msg_contacts will also be checked
<para>
<emphasis>
Default value is 60000.
Maximum value is 60000.
</emphasis>
</para>
<example>
<title>Set <varname>batch_msg_size</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("dmq_usrloc", "batch_msg_contacts", 50) # 50 contacts / message
modparam("dmq_usrloc", "batch_msg_size", 500000)
# with this config, when doing a full sync, each message will be sent a soon as the body is larger 50K or contains 50 contacts
...
</programlisting>
</example>
</section>
<section id="usrloc_dmq.p.batch_msg_contacts">
<title><varname>batch_msg_contacts</varname> (int)</title>
<para>
The parameter controls the amount of contact per message/transaction during a sync

Note that batch_msg_size will also be checked
<para>
<emphasis>
Default value is 1.
Maximum value is 150.
</emphasis>
</para>
<example>
<title>Set <varname>batch_msg_contacts</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("dmq_usrloc", "batch_msg_contacts", 50) # 50 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 50 contacts/message
...
</programlisting>
</example>
</section>
Expand Down