<div dir="ltr"><div>Hi Liviu!</div><div>And first of all thanks for your attention.</div><div><br></div><div>"Could you paste your usrloc/registrar module settings?" - here they are:<span id="gmail-LC84" class="gmail-line" lang="plaintext"><br>loadmodule "usrloc.so"</span><span id="gmail-LC85" class="gmail-line" lang="plaintext"><br>modparam("usrloc", "nat_bflag", "NAT1")</span><span id="gmail-LC86" class="gmail-line" lang="plaintext"><br>modparam("usrloc", "working_mode_preset", "sql-only")</span><span id="gmail-LC87" class="gmail-line" lang="plaintext"><br>modparam("usrloc", "use_domain", 1)</span>
<span id="gmail-LC86" class="gmail-line" lang="plaintext"></span><span id="gmail-LC89" class="gmail-line" lang="plaintext"><br></span></div><div><span id="gmail-LC89" class="gmail-line" lang="plaintext"><br></span></div><div><span id="gmail-LC89" class="gmail-line" lang="plaintext">loadmodule "registrar.so"</span><span id="gmail-LC90" class="gmail-line" lang="plaintext"><br>modparam("registrar", "default_expires", 3600)</span>
<span id="gmail-LC89" class="gmail-line" lang="plaintext"></span><span id="gmail-LC91" class="gmail-line" lang="plaintext"><br>modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT")</span><span id="gmail-LC92" class="gmail-line" lang="plaintext"><br>modparam("registrar", "max_contacts", 10)</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext"><br></span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">"The first thing I'm trying to establish is whether you considered the sql_write_mode [1] setting when implementing the requirements of your platform." -</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">Unfortunately that time when this system was developed, the newest version of OpenSIPS was 2.1 branch, that didn't have "sql_write_mode" for usrloc.</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">But still there was a "db_mode" that had "single-instance-sql-write-back" option, that wasn't enabled due to no-need for this.</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext"><br></span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">Currently we have 2.4 branch version, but still are working with db_mode parameter. Is it a bad way of handling locations?</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext"><br></span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">"Depending on your server restart policy and frequency, the optimal
solution could simply
be to switch to "write-back" (i.e. async MySQL operations),</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">which would
help scale
your registration throughput by at least an order of magnitude." - Thanks for your advice, I will consider this and will try out on a staging system.</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext"><br></span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">I also have one last question, is it a bad practice to include indexes (unique/constraint keys) into OpenSIPS table structures?</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">Such as I did with a location table (of OpenSIPS 2.4 version):</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">"UNIQUE KEY `account_contact_idx` (`username`,`domain`,`contact`,`callid`,`contact_id`)"</span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext"><br></span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">Would this have any superfluous impact on the system?<br></span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext">Have a nice day!<br></span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext"><br></span></div><div><span id="gmail-LC92" class="gmail-line" lang="plaintext"></span>
<span id="gmail-LC91" class="gmail-line" lang="plaintext"></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 2, 2019 at 11:16 AM Liviu Chircu <<a href="mailto:liviu@opensips.org">liviu@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hey Donat,<br>
<br>
Could you paste your usrloc/registrar module settings? The first thing <br>
I'm trying<br>
to establish is whether you considered the sql_write_mode [1] setting <br>
when implementing<br>
the requirements of your platform.<br>
<br>
Depending on your server restart policy and frequency, the optimal <br>
solution could simply<br>
be to switch to "write-back" (i.e. async MySQL operations), which would <br>
help scale<br>
your registration throughput by at least an order of magnitude.<br>
<br>
Best Regards,<br>
<br>
Liviu Chircu<br>
OpenSIPS Developer<br>
<a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.com</a><br>
<br>
On 30.09.2019 16:26, Donat Zenichev wrote:<br>
> Seems I found a way out:<br>
><br>
> I added 'contact_id' primary key into a list of sources columns for an <br>
> unique key, so now it looks as following:<br>
> PRIMARY KEY (`contact_id`),<br>
> UNIQUE KEY `account_contact_idx` <br>
> (`username`,`domain`,`contact`,`callid`,`contact_id`)<br>
><br>
> It didn't increase the loading on the CPU that much, but now I have:<br>
> - absence of duplicate entries (that were causing 1032 errors when <br>
> failing over to slave side)<br>
> - pretty nice capacity, as I had with usual 'account_contact_idx' <br>
> (that was without 'contact_id' PK)<br>
><br>
> But currently I have some doubts that this will cause some <br>
> unpredictable behavior.<br>
> MySQL gurus, any insight on this?<br>
<br>
_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.opensips.org" target="_blank">Devel@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#0b5394">Best regards,<br></font></div><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#0b5394">Donat Zenichev<br><br></font></div></div></div></div></div></div></div></div>