You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by zackhasit <za...@gmail.com> on 2013/08/15 16:39:47 UTC

High CPU on CMS application

Hi, I have an application that's using 20% more CPU after implementing CMS. I
was wondering if there was any way of reducing it. I am ok with reducing
functionality such as ACKs etc if that helps. There is no persistence
involved either. 5% of that increase is probably context switching so if
some threads can be reduced then that would be an option too. Any ideas ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/High-CPU-on-CMS-application-tp4670425.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: High CPU on CMS application

Posted by zackhasit <za...@gmail.com>.
Interestingly, threads are causing 5% increase mostly from unmarshal call
from openwire format but there is 20% increase in context switching
(vmstats). Profiler shows that all functions used for business logic/
processing (I mean functions of my program that were same before and after
AMQ implementation and have nothing to do with AMQ as such) have increased
CPU time significantly adding to another 15% increase. Even a call to new()
now takes twice more CPU. 

Note: System in general is 90% idle so plenty of CPU otherwise.



--
View this message in context: http://activemq.2283324.n4.nabble.com/High-CPU-on-CMS-application-tp4670425p4670443.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: High CPU on CMS application

Posted by Timothy Bish <ta...@gmail.com>.
On 08/15/2013 02:44 PM, zackhasit wrote:
> Thanks. From looking at the profiler it looks like there are a lot  more
> threads running than before (6 threads per connection to broker) and most
> increase might be context switching. Is it possible to reduce threads in
> general to bare minimum.
>
> As I see it :
>
> IOTranport thread
> DedicatedTaskRunner
> CompositeTaskRunner - Not sure ?
> 3 timer threads
>
> Can these be reduced ? Can you explain if all are necessary and what does
> Composite taskruner thread do ?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/High-CPU-on-CMS-application-tp4670425p4670434.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Sounds like you use Failover and those are threads that are used to 
manage client failover and reconnection.  The task runners will idle 
most of the time if you are connected, those only kick in once the 
connection dies and the transport needs to reconnect in the background.  
The inactivity monitor uses its own timer and task runner for async 
heartbeats and read checks on the connection.

You'd need to further profile to see if any of those threads are really 
doing much work or not.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: High CPU on CMS application

Posted by zackhasit <za...@gmail.com>.
Thanks. From looking at the profiler it looks like there are a lot  more
threads running than before (6 threads per connection to broker) and most
increase might be context switching. Is it possible to reduce threads in
general to bare minimum.

As I see it :

IOTranport thread 
DedicatedTaskRunner 
CompositeTaskRunner - Not sure ?
3 timer threads

Can these be reduced ? Can you explain if all are necessary and what does
Composite taskruner thread do ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/High-CPU-on-CMS-application-tp4670425p4670434.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: High CPU on CMS application

Posted by Timothy Bish <ta...@gmail.com>.
On 08/15/2013 02:00 PM, zackhasit wrote:
> OK. I should mention that my program has taken code directly from simple
> producer and simple consumer in the test program supplied with CMS code
> (Since I am newbie it felt easiest way). The program get messages (like
> simple consumer), does its own work and send it to another broker (like
> simple producer) . So its a combined producer consumer. I hope that helps.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/High-CPU-on-CMS-application-tp4670425p4670432.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
You can try using transacted sessions to reduce the amount of request / 
response operations going on.  Without further insight into what's going 
on all I can say is do less stuff and CPU usage will go down.

You should try to do some analysis to see what / where / when the CPU 
usage increases in you code.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: High CPU on CMS application

Posted by zackhasit <za...@gmail.com>.
OK. I should mention that my program has taken code directly from simple
producer and simple consumer in the test program supplied with CMS code
(Since I am newbie it felt easiest way). The program get messages (like
simple consumer), does its own work and send it to another broker (like
simple producer) . So its a combined producer consumer. I hope that helps.



--
View this message in context: http://activemq.2283324.n4.nabble.com/High-CPU-on-CMS-application-tp4670425p4670432.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: High CPU on CMS application

Posted by Timothy Bish <ta...@gmail.com>.
On 08/15/2013 10:39 AM, zackhasit wrote:
> Hi, I have an application that's using 20% more CPU after implementing CMS. I
> was wondering if there was any way of reducing it. I am ok with reducing
> functionality such as ACKs etc if that helps. There is no persistence
> involved either. 5% of that increase is probably context switching so if
> some threads can be reduced then that would be an option too. Any ideas ?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/High-CPU-on-CMS-application-tp4670425.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Since you haven't provided any useful context I don't think there's much 
anyone can do to help.  You need to provide more info on the way you use 
the API producers / consumers etc.  Also version number and such are 
usually useful.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/