<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLVorformatiertZchn
        {mso-style-name:"HTML Vorformatiert Zchn";
        mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert";
        font-family:Consolas;}
span.E-MailFormatvorlage20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi Stefan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">good catch. It looks indeed like a regression which was introduced there. The check seems valid, but it do not need to be executed so many times probably.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Can you open an issue on our tracker with the details and the referenced commit?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Thanks and regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Henning<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">-- <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Henning Westerholt –
</span><span style="mso-fareast-language:EN-US"><a href="https://skalatan.de/blog/"><span lang="EN-GB" style="color:#0563C1">https://skalatan.de/blog/</span></a></span><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Kamailio services –
</span><span style="mso-fareast-language:EN-US"><a href="https://gilawa.com/"><span lang="EN-GB" style="color:#0563C1">https://gilawa.com</span></a></span><span style="mso-fareast-language:EN-US">
<span lang="EN-GB"><o:p></o:p></span></span></p>
</div>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b>From:</b> sr.maillists@gmail.com <sr.maillists@gmail.com>
<br>
<b>Sent:</b> Wednesday, February 24, 2021 10:06 PM<br>
<b>To:</b> sr-users@lists.kamailio.org<br>
<b>Cc:</b> Henning Westerholt <hw@skalatan.de><br>
<b>Subject:</b> Re: [SR-Users] Kamailio 5.4.4 extremely slow carrierroute preloading<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">Hello there<br>
<br>
I nailed the problem down to a version now: It began with version 5.0.4.<br>
With 5.0.3 it's fast, only 10 seconds.<br>
With 5.0.4 it takes 16 minutes!<br>
<br>
In postgres log I see always the same query "SELECT * FROM carrierroute WHERE carrier=1 and domain=1 and prob>0"<br>
like it's in a loop. I did not observe this with version 5.0.3.<br>
<br>
I believe it's this change in carrierroute module:<o:p></o:p></p>
<pre style="margin-left:35.4pt">commit 9800aba65146b72623bb512049300d1beb8c8ec4<o:p></o:p></pre>
<pre style="margin-left:35.4pt">Author: Huseyin Dikme <a href="mailto:hueseyin.dikme@1und1.de"><hueseyin.dikme@1und1.de></a><o:p></o:p></pre>
<pre style="margin-left:35.4pt">Date:   Tue Sep 12 15:37:17 2017 +0200<o:p></o:p></pre>
<pre style="margin-left:35.4pt"><o:p> </o:p></pre>
<pre style="margin-left:35.4pt">    carrierroute: warning for the same carrier/domain having routes with only 0 probability<o:p></o:p></pre>
<pre style="margin-left:35.4pt">    <o:p></o:p></pre>
<pre style="margin-left:35.4pt">    - While starting kamailio or reloading the routes, if the same carrier/domain pairs do not have<o:p></o:p></pre>
<pre style="margin-left:35.4pt">      any route with a probability other than 0 (zero) then an error log will be printed on the screen.<o:p></o:p></pre>
<pre style="margin-left:35.4pt">      Besides, the log "invalid dice_max value" in the cr_func.c has been made more clear.<o:p></o:p></pre>
<pre style="margin-left:35.4pt">    <o:p></o:p></pre>
<pre style="margin-left:35.4pt">    (cherry picked from commit 9741bee7af8136b35af8e6279e530aa0ad54f574)<o:p></o:p></pre>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:35.4pt">
I don't understand much in the code, but for me it seems like for every entry in carrierroute it generates a query to check if there are same routes with probability 0.<br>
<br>
Regards<br>
Stefan<br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">Am 24.02.21 um 18:02 schrieb <a href="mailto:sr.maillists@gmail.com">
sr.maillists@gmail.com</a>:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-left:35.4pt">Hi Henning <br>
<br>
Thanks for your fast response. I switched the parameter back to 2000. <br>
Ok some more details: <br>
I compiled now 4.4.7 and this loads like 4.3.6 in 10s. <br>
Then I compiled 5.0.8 and now it's so slow, I can watch loading single entries in the logfile.
<br>
<br>
I think somewhere between 4.4.7 and 5.0.8 changed something which makes it so slow.
<br>
Will try to find the e-mail and some hints where the problem could be. <br>
In the meantime I will try to stick with version 4.4.7. <br>
<br>
Regards <br>
Stefan <br>
<br>
Am 24.02.21 um 17:49 schrieb Henning Westerholt: <br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:35.4pt">
Hello, <br>
<br>
the fetch_rows parameter is just to specify the number of routes to load _at once_. So, you should not set it to the complete size, but keep it more in the range of the default value.
<br>
<br>
About the general slower loading, there has been another e-mail some weeks ago that mention a similar problem.
<br>
<br>
Please try again with a proper fetch_rows setting. If its still happens, you can open a github issue about it, it seems indeed like a regression
<br>
<br>
Cheers, <br>
<br>
Henning <o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
</div>
</body>
</html>