<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=us-ascii">
<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:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle24
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle25
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle26
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle27
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle28
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle29
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle30
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle31
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle32
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle33
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle34
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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 bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi Liviu, <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thank you for the response. <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">If we configure connection_timeout as &#8216;2&#8217;, then request will be sent out after 200ms. Am I right? Or your re-work will still reduce this value?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Are you going to add one more parameter &#8220;connect_polling_interval&#8221; and what will be use case of it?
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Is it replacement for 10% wait time logic?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Also, I observed in the case of async call, it takes ~90 to 100ms to open the port itself. Is this expected behavior?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Because in synchronous case TCP port open is so quick within ~8 to 10ms.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Regards,<br>
Agalya<o:p></o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> Liviu Chircu [mailto:liviu@opensips.org]
<br>
<b>Sent:</b> Wednesday, September 14, 2016 4:33 AM<br>
<b>To:</b> Ramachandran, Agalya (Contractor) &lt;Agalya_Ramachandran@comcast.com&gt;; OpenSIPS users mailling list &lt;users@lists.opensips.org&gt;<br>
<b>Subject:</b> Re: FW:[OpenSIPS-Users] Asynchronous operation for REST queries<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p><tt><span style="font-size:10.0pt">Thank you for the logs, this is what I was looking for:</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Sep 12 19:39:34 sturn-test /usr/local/sbin/opensips[23877]: DBG:rest_client:start_async_http_req: libcurl TCP connect: we should wait up to 977ms (timeout=1000ms)!</span></tt><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;"><br>
<tt>Sep 12 19:39:34 sturn-test /usr/local/sbin/opensips[23877]: DBG:rest_client:start_async_http_req: busy waiting 98ms ...</tt></span><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">So libcurl tells us we should wait, at most, 1 second before we can proceed with the transfer. The logic I added on the dev branch only waits 10% of this interval (98ms), but it's obviously way too much, since the connection
 is up within 8ms.</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">I will rework this 10% logic into a &quot;connect_polling_interval&quot; (milliseconds) module parameter, so you can customize it according to your environment and start your transfers a lot faster.</span></tt><o:p></o:p></p>
<pre>Liviu Chircu<o:p></o:p></pre>
<pre>OpenSIPS Developer<o:p></o:p></pre>
<pre><a href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 13.09.2016 21:14, Ramachandran, Agalya (Contractor) wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:blue">Hi Liviu, </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">I have configured &#8220;Connection_timeout&#8221; value as &#8216;1&#8217; and ran 2 sipp calls.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">After TCP port is opened, HTTP request is sent out approx. 95 to 100ms later. Am attaching the log of the opensips by enabling debugging log.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">I took the code from master branch and tested it out. If you find everything OK let me know.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Or if you feel to test any specific scenario please update me, so that I can test and share you the results.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">P.S:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">One more observance.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">In the case of synchronous, TCP port is opened within 8 ms, whereas in the case of async TCP port is opening after 100 ms.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Is it the expected behavior?.&nbsp; </span>
<o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">What will be expected time to give this fix in a branch version?
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Log file ~70 MB if I enable the debug calls for single call and couldn&#8217;t post you that log, since it says limit for email is 40 MB.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Regards,<br>
Agalya</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;</span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> Liviu Chircu [<a href="mailto:liviu@opensips.org">mailto:liviu@opensips.org</a>]
<br>
<b>Sent:</b> Monday, September 12, 2016 4:06 AM<br>
<b>To:</b> OpenSIPS users mailling list <a href="mailto:users@lists.opensips.org">
&lt;users@lists.opensips.org&gt;</a>; Ramachandran, Agalya (Contractor) <a href="mailto:Agalya_Ramachandran@comcast.com">
&lt;Agalya_Ramachandran@comcast.com&gt;</a><br>
<b>Subject:</b> Re: FW:[OpenSIPS-Users] Asynchronous operation for REST queries</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">&nbsp;<o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Hi Agalya,</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">The &quot;connection_timeout&quot; is a configurable module parameter, so tuning it properly might just solve your problem.</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">If you need more assistance, please enable debug logging (log_level = 4), run the query and post the full log output.</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Best regards,</span></tt><o:p></o:p></p>
<pre>Liviu Chircu<o:p></o:p></pre>
<pre>OpenSIPS Developer<o:p></o:p></pre>
<pre><a href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 09.09.2016 23:04, Ramachandran, Agalya (Contractor) wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:blue">Hi Liviu, </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">I have tested the patch. Now I see the delay is 2 secs. i.e after 2 secs it sends the HTTP request out.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">I suspect this 2000 ms delay is due to the below field:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:red">long connection_timeout = 20; </span>
<o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Can we reduce this field to 5 or 10, so that it waits only half a second or second to send the request out.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Let me know your thoughts on this. </span>
<o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Am seeing the below message in logs. Is everything working as you expected?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:red">rest_client:start_async_http_req: libcurl TCP connect: we should wait up to 1ms (timeout=20000ms)!</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">&nbsp;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Agalya</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;</span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> Liviu Chircu [<a href="mailto:liviu@opensips.org">mailto:liviu@opensips.org</a>]
<br>
<b>Sent:</b> Thursday, September 08, 2016 7:05 AM<br>
<b>To:</b> Ramachandran, Agalya (Contractor) <a href="mailto:Agalya_Ramachandran@comcast.com">
&lt;Agalya_Ramachandran@comcast.com&gt;</a>; Bogdan-Andrei Iancu <a href="mailto:bogdan@opensips.org">
&lt;bogdan@opensips.org&gt;</a>; OpenSIPS users mailling list <a href="mailto:users@lists.opensips.org">
&lt;users@lists.opensips.org&gt;</a><br>
<b>Subject:</b> Re: FW:[OpenSIPS-Users] Asynchronous operation for REST queries</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">&nbsp;<o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Hi, Agalya!</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Regarding the 10s delay problem, a fix was pushed to the development branch [1]. If you are running on 2.1.4 git branch, could you please pull the latest changes (git pull --rebase), and test it out? You can import it with:</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">git cherry-pick -x&nbsp; 66c337cc</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">[1]: <a href="https://github.com/OpenSIPS/opensips/commit/66c337cc89a2b5c3e1bbd78c289371efcda21886">
https://github.com/OpenSIPS/opensips/commit/66c337cc89a2b5c3e1bbd78c289371efcda21886</a></span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Best regards,</span></tt><o:p></o:p></p>
<pre>Liviu Chircu<o:p></o:p></pre>
<pre>OpenSIPS Developer<o:p></o:p></pre>
<pre><a href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
</blockquote>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif"><o:p>&nbsp;</o:p></span></p>
</div>
</body>
</html>