<p dir="ltr">Hi Prashant,<br>
If I were to do it the lazy way and if I have understood your requirement completely. I might've ended up using snmp monitoring of the CPU and set a memcache/redis variable to be 0 or 1 in case CPU goes above or below 70. <br>
In my kamailio.cfg I would just check that redis variable and decide whether to drop requests or continue with the config.<br>
 <br>
Isn't that something that can help you ? </p>
<p dir="ltr">Thanks,<br>
Sammy</p>
<div class="gmail_quote">On Mar 1, 2016 09:00, "Prashant Desai" <<a href="mailto:pdesai05@gmail.com">pdesai05@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br>





<div class="gmail_quote"><div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal">Hi Kamailio,<u></u><u></u></p>
<p class="MsoNormal">                We are using Kamailio V4.2.3 for our project and we are trying to address the performance requirement. We have following queries
<u></u><u></u></p>
<p class="MsoNormal">and need some inputs from Kamailio. <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><b>Requirement :</b> CPU Utilization Limit to 70%, If the limit is crossed Kamailio has to reject the Request.
<u></u><u></u></p>
<p class="MsoNormal">And If it is within the limit Kamailio has to Process the Requests. (i.e. Kamailio has to dynamically set and reset the policy based on CPU Load).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><b>Our Findings</b> : We have come across ratelimit module in Kamailio, we tried using the same to address the requirement<u></u><u></u></p>
<p class="MsoNormal">but we see it is not  dynamically setting and resetting the policy (once if it starts rejecting then every time it rejects it, only if we restart the kamailo it works)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><b>What we Need</b>: We need to know<u></u><u></u></p>
<p><u></u><span>1.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>Are we using the right module to address the above requirement ?<u></u><u></u></p>
<p><u></u><span>2.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>We are only using ratelimit, module, do we have to include any other module along with ratelimit?<u></u><u></u></p>
<p><u></u><span>3.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>We are using FEEDBACK algorithm, is that OK ?<u></u><u></u></p>
<p><u></u><span>4.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>Setting  “ modparam("ratelimit", "pipe", "3:FEEDBACK:70") “ , is this correct ?<u></u><u></u></p>
<p><u></u><span>5.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>In ratelimit.c , function <u></u><u></u></p>
<p style="text-indent:.5in"> static int pipe_push(struct sip_msg * msg, int id)<span style="font-size:10.0pt;font-family:Consolas;color:black"> {</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black">             
</span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7f0055">case</span></b><span style="font-size:10.0pt;font-family:Consolas;color:black">
</span><i><span style="font-size:10.0pt;font-family:Consolas;color:#0000c0">PIPE_ALGO_FEEDBACK</span></i><span style="font-size:10.0pt;font-family:Consolas;color:black">:</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black">                    
<u>LM_DBG(</u></span><u><span style="font-size:10.0pt;font-family:Consolas;color:#2a00ff">"drop_rate [%d],hash[*pipes[id].counter][%d]\n"</span></u><u><span style="font-size:10.0pt;font-family:Consolas;color:black">,*drop_rate, hash[*<span style="background:silver">pipes</span>[id].</span></u><u><span style="font-size:10.0pt;font-family:Consolas;color:#0000c0">counter</span></u><u><span style="font-size:10.0pt;font-family:Consolas;color:black">])</span></u><span style="font-size:10.0pt;font-family:Consolas;color:black">;</span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p style="margin-left:1.0in"><span style="font-size:10.0pt;font-family:Consolas;color:black">                     ret =
<span style="background:yellow">(hash[*pipes[id].</span></span><span style="font-size:10.0pt;font-family:Consolas;color:#0000c0;background:yellow">counter</span><span style="font-size:10.0pt;font-family:Consolas;color:black;background:yellow">
 % 100]</span><span style="font-size:10.0pt;font-family:Consolas;color:black"> < *drop_rate) ? -1 : 1;</span><u></u><u></u></p>
<p style="margin-left:1.0in"><span style="font-size:10.0pt;font-family:Consolas;color:black">}<u></u><u></u></span></p>
<p class="MsoNormal">                We are not able to understand the above line (<span style="font-size:10.0pt;font-family:Consolas;color:black;background:yellow">hash[*pipes[id].</span><span style="font-size:10.0pt;font-family:Consolas;color:#0000c0;background:yellow">counter</span><span style="font-size:10.0pt;font-family:Consolas;color:black;background:yellow">
 % 100]</span>). Could you please elaborate.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p><u></u><span>6.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>Where are we lagging ?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Regards,<u></u><u></u></p>
<p class="MsoNormal">Prashanth<u></u><u></u></p>
<p class="MsoNormal">                <u></u><u></u></p>
</div>

<div><p></p><hr>
============================================================================================================================<br>
Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html" target="_blank">http://www.techmahindra.com/Disclaimer.html</a> externally <a href="http://tim.techmahindra.com/tim/disclaimer.html" target="_blank">http://tim.techmahindra.com/tim/disclaimer.html</a> internally within TechMahindra.<br>
============================================================================================================================<br>

<p></p></div>
</div>

</div><br></div>
<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div>