You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by khandelwalanuj <kh...@gmail.com> on 2014/01/13 15:29:41 UTC

Re: What is the effect of dedicatedTaskRunner Attribute?

If I disable dedicatedTaskRunner:

1. Does it means there will not be one thread per connection or
    Does it means there will not be one thread per queue/topic ?? 

2. What is the size of thread pool if I don't use dedicatedTaskRunner ?

Thanks,
Anuj



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4676233.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by Christian Posta <ch...@gmail.com>.
can you explain the performance bottlenecks you're seeing for your use
case (heavy thread context switch, lock contention?)?

On Mon, Feb 24, 2014 at 2:17 AM, khandelwalanuj
<kh...@gmail.com> wrote:
>>> I do not see a reason why you would want idle threads to be kept for a
> longer period, especially if there >> are several TaskRunnerFactory
> instances in use - this would simply leave idle threads in memory
>
> I was thinking about load on the broker to create and destroy threads
> continuously. Lots of thread creation can affect performance of the broker,
> that's why I am thinking to retain the threads in memory.
>
> Thanks,
> Anuj
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4678299.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by khandelwalanuj <kh...@gmail.com>.
>> I do not see a reason why you would want idle threads to be kept for a
longer period, especially if there >> are several TaskRunnerFactory
instances in use - this would simply leave idle threads in memory 

I was thinking about load on the broker to create and destroy threads
continuously. Lots of thread creation can affect performance of the broker,
that's why I am thinking to retain the threads in memory.

Thanks,
Anuj



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4678299.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by oliverd <ol...@hotmail.com>.
default thread pool in TaskRunnerFactory is initialized with a
corePoolSize=0, i.e. no idle thread should be kept after keepAliveTime
(works as coded)

I do not see a reason why you would want idle threads to be kept for a
longer period, especially if there are several TaskRunnerFactory instances
in use - this would simply leave idle threads in memory

the idleTimeout (keepAliveTime, default 30) can be increased using a system
property org.apache.activemq.thread.TaskRunnerFactory.keepAliveTime 
so that less thread recreation is needed depending on broker activity



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4677933.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by khandelwalanuj <kh...@gmail.com>.
Can you please respond to my second question that why thread pool is not
keeping the threads?

Thanks,
Anuj




--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4677932.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by oliverd <ol...@hotmail.com>.
I think this was addressed in https://issues.apache.org/jira/browse/AMQ-4205

defaults are unchanged, but timeouts are configurable now



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4677929.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by khandelwalanuj <kh...@gmail.com>.
I explored a little bit about it and found that in v5.6 this change was
done.. 
https://issues.apache.org/jira/browse/AMQ-3667

Again coming back to the issue, I am now using pooled connection factory for
my broker and seeing that this task thread is continuously getting created
and destroyed. For example this is one of the thread name in my production
environment: *ActiveMQ BrokerService[mqbrokerdev] Task-50456* thread names.

Please note that at a time there are around 15-20 threads only but still why
old threads are destroyed and new one's are getting created if ActiveMQ uses
thread pool. Ideally It should keep one thread after it's job is done and
assign the same thread for the next task. ??

Thanks,
Anuj 



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4677924.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by khandelwalanuj <kh...@gmail.com>.
Hey, I am using ActiveMQ v5.8. AND I was surprised to see that *default value
of dedicatedTaskrunner is false which means ActiveMQ uses thread pool by
default.* which contradict the statement given by ActiveMQ vendors
(http://activemq.apache.org/how-do-i-configure-10s-of-1000s-of-queues-in-a-single-broker-.html)

Can you check this. 

Thanks,
Anuj




--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4677918.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by oliver49 <ol...@hotmail.com>.
When setting optimizedDispatch the transport thread will directly do the
dispatch to queue, otherwise a broker task thread does it.

If you want to get a better understanding you can either dig into code or
(simpler) look at some traces, e.g. setting DEBUG level trace for:
 org.apache.activemq.broker, org.apache.activemq.thread,
org.apache.activemq.transport
Then process a message and look at the log output including thread names for
certain actions.

The task threads in the thread dump are named as BrokerService[mqbrokerdev]
Task-1, Task-2.

Regarding thread reduction. You will not see this directly in the thread
overview as the threads are created on demand and might be gone already
doing the thread dump. Setting UseDedicatedTaskRunner=true creates a
dedicated thread for each task. Setting it to false uses a PooledTaskRunner
and a thread from a thread pool.
The difference is only obvious in the thread dump if there is really a lot
of traffic on the broker.

By the way. If org.apache.activemq.UseDedicatedTaskRunner is not explicitly
set to true, then thread pooling will be used.



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4677849.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by khandelwalanuj <kh...@gmail.com>.
Hey,

So If I use this configuration : *"optimizedDispatch=true" and
"org.apache.activemq.UseDedicatedTaskRunner=true"   
*
 
It means the sending thread will do dispatch, (There will not be a separate
thread for dispatch) and it will not use ActiveMQ thread pool (since I have
enabled dedicated task runner which is also in default configuration). 

AND

I am not able to find the thread name for dispatch and send. I have attached
my thread trace here which is pasted below:

I have tested by disabling dedicated task runner in my setup but not found
any thread reduction.
Can you tell me which threads (THREAD NAME) are going to reduce in below
thread trace if I disable dedicatedTaskRunner ?


    45  5           0           0           0           0 KahaDB Scheduler
    46  5          16          16          10          10 ActiveMQ Journal
Checkpoint Worker
    47 10           2           2           0           0 ActiveMQ Data File
Writer
    48  5           1           1           0           0 KahaDB Scheduler
    49  5          21          21          10          10 ActiveMQ Journal
Checkpoint Worker
    50 10           2           2           0           0 ActiveMQ Data File
Writer
    51  5           0           0           0           0 ActiveMQ Durable
Subscriber Cleanup Timer
    53  5          19          19          10          10 StatsCollector-1
    54  5           1           1           0           0 KahaDB Scheduler
    55 10           4           4           0           0 ActiveMQ Data File
Writer
    69  8          56          56          50          50 ActiveMQ Transport
Server Thread Handler:
tcp://0.0.0.0:61616?wireFormat.maxInactivityDuration=30000
    70  9           6           6           0           0 ActiveMQ Transport
Server: tcp://0.0.0.0:61616?wireFormat.maxInactivityDuration=30000
    71  8           6           6           0           0 ActiveMQ Transport
Server Thread Handler:
nio://0.0.0.0:61615?wireFormat.maxInactivityDuration=30000
    72  9          11          11           0           0 ActiveMQ Transport
Server: nio://0.0.0.0:61615?wireFormat.maxInactivityDuration=30000
    73  8           5           5           0           0 ActiveMQ Transport
Server Thread Handler:
stomp://0.0.0.0:61613?transport.defaultHeartBeat=5000,0
    74  9           5           5           0           0 ActiveMQ Transport
Server: stomp://0.0.0.0:61613?transport.defaultHeartBeat=5000,0
    75  8           5           5           0           0 ActiveMQ Transport
Server Thread Handler:
stomp+nio://0.0.0.0:61614?wireFormat.maxInactivityDuration=30000
    76  9           8           8           0           0 ActiveMQ Transport
Server: stomp+nio://0.0.0.0:61614?wireFormat.maxInactivityDuration=30000
    78  5          23          23          20          20 ActiveMQ
BrokerService[mqbrokerdev] Task-1
    79  5          86          86          80          80 ActiveMQ
Transport: tcp:///*.*.*.*:57252@61616
    80  5          28          28          20          20 ActiveMQ
BrokerService[mqbrokerdev] Task-2
    81  5           2           2           0           0 ActiveMQ
InactivityMonitor ReadCheckTimer
    82  5           6           6           0           0 ActiveMQ
InactivityMonitor WriteCheckTimer
    83  5          10          10           0           0 ActiveMQ
Transport: tcp:///*.*.*.*:57261@61616
    84  5          17          17          10          10 ActiveMQ
Transport: tcp:///*.*.*.*:57301@61616
    85  5          20          20          10          10 ActiveMQ
Transport: tcp:///*.*.*.*:57306@61616
    89  5           1           1           0           0 ActiveMQ
InactivityMonitor Worker


Thanks,
Anuj 



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4677848.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by Gary Tully <ga...@gmail.com>.
you got to peek at the code to get exact detail.
see: https://github.com/apache/activemq/blob/trunk/activemq-client/src/main/java/org/apache/activemq/thread/TaskRunnerFactory.java?source=cc#L86

so it is either dedicated or shared (pooled)

optimizeDispatch is per destination, and controls whether the sending
thread gets to attempt dispatch, or whether this happens in a
destination dispatch thread (which will use a task runner) - so this
one is very specific.



On 11 February 2014 11:06, khandelwalanuj <kh...@gmail.com> wrote:
> Guys please respond !!
>
> Give me some idea about dedicated task runner. I am now totally confused
> between
>
> *dedicated task runner
> Pooled task runner
> *and
> o*ptimizedisaptch
> *
>
> By making * org.apache.activemq.UseDedicatedTaskRunner=false * is it by
> default enable pooledtaskrunner or it's just disable desicatedtaskrunner ?
> What does it exactly do ?
>
> Thanks,
> Anuj
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4677773.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by khandelwalanuj <kh...@gmail.com>.
Guys please respond !!

Give me some idea about dedicated task runner. I am now totally confused
between 

*dedicated task runner 
Pooled task runner
*and 
o*ptimizedisaptch
*

By making * org.apache.activemq.UseDedicatedTaskRunner=false * is it by
default enable pooledtaskrunner or it's just disable desicatedtaskrunner ?
What does it exactly do ?

Thanks,
Anuj



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4677773.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by khandelwalanuj <kh...@gmail.com>.
I didn't get it.

By default DedicatedTaskRunner  is enabled (TRUE). So does it mean there is
only one thread to execute all the tasks ? That sounds wrong to me. 

It should me something like "execute all the tasks of a queue or client ?"

Please clearify more.

Thanks,
Anuj




--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4676301.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Re: What is the effect of dedicatedTaskRunner Attribute?

Posted by bizcenter <bi...@gmail.com>.
Activemq supports DedicatedTaskRunner and PooledTaskRunner:
DedicatedTaskRunner: One thread to execute all tasks.
PooledTaskRunner:      Thread pool to execute all tasks, default size is Integer.MAX_VALUE.





bizcenternet@gmail.com

From: khandelwalanuj [via ActiveMQ]
Date: 2014-01-13 22:30
To: bizcenter
Subject: Re: What is the effect of dedicatedTaskRunner Attribute?

If I disable dedicatedTaskRunner: 

1. Does it means there will not be one thread per connection or 
    Does it means there will not be one thread per queue/topic ?? 

2. What is the size of thread pool if I don't use dedicatedTaskRunner ? 

Thanks, 
Anuj 




If you reply to this email, your message will be added to the discussion below:
http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4676233.html 
To start a new topic under ActiveMQ - User, email ml-node+s2283324n2341805h73@n4.nabble.com 
To unsubscribe from ActiveMQ, click here.
NAML 



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-effect-of-dedicatedTaskRunner-Attribute-tp2363191p4676261.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.