You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by larry hughes <ty...@hotmail.com> on 2007/07/27 21:45:28 UTC

thread pools and components

I would like to understand how the configuration of the thread pool in
Servicemix works with respect to the components in the service assembly. 
Suppose I configure servicemix like this:

---------------------------------------
servicemix.corePoolSize = 1
servicemix.maximumPoolSize = 1
servicemix.queueSize = 128
--------------------------------------

Now I've deployed a service assembly which contains 4 components-- 1)
filepoller, 2) xslt, 3) lw component, 4) bridge.  The filepoller polls and
sends files to the bridge.  The bridge first sends it to the xslt component
for transformation, then sends this transformed document to the lw component
which does its thing.

Since there is only 1 thread configured, will servicemix create four
threads, one for each component, i.e. 1 for file poller, 1 for xslt, 1 for
bridge, and 1 for lw, or is this 1 thread for the entire service assembly,
i.e. filepoller gets the thread and needs to finish, then the thread is
allocated for the bridge, and so on?  And how does the queueSize fit into
all of this?

Larry
-- 
View this message in context: http://www.nabble.com/thread-pools-and-components-tf4159831s12049.html#a11835670
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: thread pools and components

Posted by sachin2008 <es...@gmail.com>.
Can anyone provide the sample code for this configurations.

larry hughes wrote:
> 
> I would like to understand how the configuration of the thread pool in
> Servicemix works with respect to the components in the service assembly. 
> Suppose I configure servicemix like this:
> 
> ---------------------------------------
> servicemix.corePoolSize = 1
> servicemix.maximumPoolSize = 1
> servicemix.queueSize = 128
> --------------------------------------
> 
> Now I've deployed a service assembly which contains 4 components-- 1)
> filepoller, 2) xslt, 3) lw component, 4) bridge.  The filepoller polls and
> sends files to the bridge.  The bridge first sends it to the xslt
> component for transformation, then sends this transformed document to the
> lw component which does its thing.
> 
> Since there is only 1 thread configured, will servicemix create four
> threads, one for each component, i.e. 1 for file poller, 1 for xslt, 1 for
> bridge, and 1 for lw, or is this 1 thread for the entire service assembly,
> i.e. filepoller gets the thread and needs to finish, then the thread is
> allocated for the bridge, and so on?  And how does the queueSize fit into
> all of this?
> 
> Larry
> 

-- 
View this message in context: http://www.nabble.com/thread-pools-and-components-tp11835670s12049p14946411.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: thread pools and components

Posted by Arif Mohd <ar...@wipro.com>.
Hi bsnyder,

    I tried to understand the bottomn of the given page, but iam confused
here.
    It will be a greatful to me, if you could explain it by using numbers
    In the example given by larry, let me explain my understanding and
suggest me if iam wrong

     -First a thread will be allocated to FilePoller
     -once the transformer is invoked by filepoller another thread should be
created and since number of current threads(1) is not less than core pool
size the tranformation job is queued
           - here one question until the thread is released by FilePoller
component, is trasformation job will be queued?



bsnyder wrote:
> 
> On 7/27/07, larry hughes <ty...@hotmail.com> wrote:
>>
>> I would like to understand how the configuration of the thread pool in
>> Servicemix works with respect to the components in the service assembly.
>> Suppose I configure servicemix like this:
>>
>> ---------------------------------------
>> servicemix.corePoolSize = 1
>> servicemix.maximumPoolSize = 1
>> servicemix.queueSize = 128
>> --------------------------------------
>>
>> Now I've deployed a service assembly which contains 4 components-- 1)
>> filepoller, 2) xslt, 3) lw component, 4) bridge.  The filepoller polls
>> and
>> sends files to the bridge.  The bridge first sends it to the xslt
>> component
>> for transformation, then sends this transformed document to the lw
>> component
>> which does its thing.
>>
>> Since there is only 1 thread configured, will servicemix create four
>> threads, one for each component, i.e. 1 for file poller, 1 for xslt, 1
>> for
>> bridge, and 1 for lw, or is this 1 thread for the entire service
>> assembly,
>> i.e. filepoller gets the thread and needs to finish, then the thread is
>> allocated for the bridge, and so on?  And how does the queueSize fit into
>> all of this?
> 
> Each flow in ServiceMix (the JCAFlow, AbstractJMSFlow and SedaQueue
> classes) uses an executor to create a new thread each time a message
> exchange is enqueued. Further, as the page about thread pools
> (http://incubator.apache.org/servicemix/thread-pools.html) explains
> near the bottom:
> 
> When the executor receives a new task, the following happen:
> 
> * if the number of threads is less than corePoolSize, the executor
> will create a new thread to handle the job
> * if the number of queued jobs is less than queueSize, the job is queued
> * if the queue is full and the number of threads is less than
> maximumPoolSize, a new thread is created to handle the job
> * else, the current thread will handle the job
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache Geronimo - http://geronimo.apache.org/
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Castor - http://castor.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/thread-pools-and-components-tf4159831s12049.html#a11962337
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: thread pools and components

Posted by Bruce Snyder <br...@gmail.com>.
On 7/27/07, larry hughes <ty...@hotmail.com> wrote:
>
> I would like to understand how the configuration of the thread pool in
> Servicemix works with respect to the components in the service assembly.
> Suppose I configure servicemix like this:
>
> ---------------------------------------
> servicemix.corePoolSize = 1
> servicemix.maximumPoolSize = 1
> servicemix.queueSize = 128
> --------------------------------------
>
> Now I've deployed a service assembly which contains 4 components-- 1)
> filepoller, 2) xslt, 3) lw component, 4) bridge.  The filepoller polls and
> sends files to the bridge.  The bridge first sends it to the xslt component
> for transformation, then sends this transformed document to the lw component
> which does its thing.
>
> Since there is only 1 thread configured, will servicemix create four
> threads, one for each component, i.e. 1 for file poller, 1 for xslt, 1 for
> bridge, and 1 for lw, or is this 1 thread for the entire service assembly,
> i.e. filepoller gets the thread and needs to finish, then the thread is
> allocated for the bridge, and so on?  And how does the queueSize fit into
> all of this?

Each flow in ServiceMix (the JCAFlow, AbstractJMSFlow and SedaQueue
classes) uses an executor to create a new thread each time a message
exchange is enqueued. Further, as the page about thread pools
(http://incubator.apache.org/servicemix/thread-pools.html) explains
near the bottom:

When the executor receives a new task, the following happen:

* if the number of threads is less than corePoolSize, the executor
will create a new thread to handle the job
* if the number of queued jobs is less than queueSize, the job is queued
* if the queue is full and the number of threads is less than
maximumPoolSize, a new thread is created to handle the job
* else, the current thread will handle the job

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/