<div>Hello list,</div><div><br></div><div>I have a custom made module which uses a timer to monitor some statuses in a period of 1 second. Inside the function there&#39;s a loop that iterates over a table that can contain several hundreds of items and using each of them to perform some arithmetical operations. </div>
<div><br></div><div>Under certain conditions, the number of items can grow to a few thousands in really exceptional cases and I believe this situation is causing Kamailio&#39;s slow timer process to consume more than 90% of CPU hanging up the other group of processes. </div>
<div><br></div><div>My questions are:</div><div><br></div><div>- What is the best way to perform a repetitive task such as a loop in a timely basis taking in consideration a precision of at least 5 seconds? I&#39;m currently registering a function using <i style="font-weight:bold">register_timer() </i>call.</div>
<div><br></div><div>- Can a loop that takes more than 1 second to complete be causing this extremely high CPU consumption? </div><div><br></div><div>Below is a copy of the top command when the event occurred:</div><div><br>
</div><div>PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND</div>22969 root      20   0 2140m  16m  14m R <b>98.8</b>  0.1   7:22.03 kamailio  <div><br clear="all"><div>Thanks in advance,</div><div><br></div>
-- <br>Carlos<div><a href="http://caruizdiaz.com" target="_blank">http://caruizdiaz.com</a></div><div>+595981146623</div>
</div>