[sr-dev] Using timers

Carlos Ruiz Díaz carlos.ruizdiaz at gmail.com
Mon Feb 18 15:36:31 CET 2013


Hello list,

I have a custom made module which uses a timer to monitor some statuses in
a period of 1 second. Inside the function there'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.

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's slow timer process to consume more than 90% of CPU hanging up
the other group of processes.

My questions are:

- 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'm
currently registering a function using *register_timer() *call.

- Can a loop that takes more than 1 second to complete be causing this
extremely high CPU consumption?

Below is a copy of the top command when the event occurred:

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
22969 root      20   0 2140m  16m  14m R *98.8*  0.1   7:22.03 kamailio

Thanks in advance,

-- 
Carlos
http://caruizdiaz.com
+595981146623
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20130218/a3c5f1c2/attachment.htm>


More information about the sr-dev mailing list