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,
Hi Carlos,
i hope you are doing fine :-) You may run into troubles, if your timer process takes too long; so you might consider using a separate process for "expensive" operations, maybe you want to look at the nathelper module, which does the trick.
Kind regards, Carsten
2013/2/18 Carlos Ruiz Díaz carlos.ruizdiaz@gmail.com:
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
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Hi Carsten,
I'll take a look to that module to learn how it should be done.
Thanks a lot!.
Carlos.
On Fri, Feb 22, 2013 at 1:45 PM, Carsten Bock carsten@ng-voice.com wrote:
Hi Carlos,
i hope you are doing fine :-) You may run into troubles, if your timer process takes too long; so you might consider using a separate process for "expensive" operations, maybe you want to look at the nathelper module, which does the trick.
Kind regards, Carsten
2013/2/18 Carlos Ruiz Díaz carlos.ruizdiaz@gmail.com:
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
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
-- Carsten Bock CEO (Geschäftsführer)
============================================================= Visit us on the Kamailio World 2013, 16./17. April 2013 => http://conference.kamailio.com/k01/ See you there! =============================================================
ng-voice GmbH Schomburgstr. 80 D-22767 Hamburg / Germany
http://www.ng-voice.com mailto:carsten@ng-voice.com
Office +49 40 34927219 Fax +49 40 34927220
Sitz der Gesellschaft: Hamburg Registergericht: Amtsgericht Hamburg, HRB 120189 Geschäftsführer: Carsten Bock Ust-ID: DE279344284
Hier finden Sie unsere handelsrechtlichen Pflichtangaben: http://www.ng-voice.com/imprint/
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev