You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by arturs <ar...@gmail.com> on 2008/07/21 17:39:43 UTC

camel jetty multithreading in multicast

Hi,
I need some help. I spent few days googling and debugging but was unable to
find solution for my problem. Please clarify me it what i found is the
camel's desired behavior (Camel 1.3 deployed in IONA Fuse service mix) or a
bug. If this is not a bug , i would be grateful for any hints.

I have the following configuration:

private static final String PARAllEL_PROCESSING_POINT = "direct:mainflow";


	from("jetty:http://localhost:8999/my).convertBodyTo(String.class)
			.to("log:incomingRequest")
			.to(PARALLEL_PROCESSING_POINT)
			.to("log:after mainflow");
					
		
		from(PARALLEL_PROCESSING_POINT)
		.multicast(parallelFlowAggregationStrategy,true)
		.to(“log: first”,”log: second”);

Jetty is my entry point to which I send xml requests. I'm using jmeter to
send requests in multiple threads at once. When I set multicast to fork into
subflows I keep getting :


ERROR - DeadLetterChannel              - Failed delivery for exchangeId:
ID-S205410J4462164/3125-1216299226744/0-0. On delivery attempt: 0 caught:
java.util.concurrent.RejectedExecutionException
java.util.concurrent.RejectedExecutionException
	at
org.apache.camel.processor.MulticastProcessor$2.rejectedExecution(MulticastProcessor.java:231)
	at
java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
	at
java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658)
	at
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:164)
	at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
	at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:146)
	at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:90)
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:53)
	at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:67)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:73)
	at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:146)
	at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:90)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
	at
org.apache.camel.component.jetty.CamelContinuationServlet.service(CamelContinuationServlet.java:66)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
	at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
	at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
	at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)


The more threads I  start the more often exception occurs. It works hen I
disable forking for multicast.  I tried to resolve this problem by setting
threads(..) just after jetty , but this didn't work because there were messy
responses back on jetty(another issue?? ) . This is just an example. The
real life application's flow is much more complicated and for performance
reasons i would like to use parallel processing wherever possible.

Any suggestions?

Kind regards.
Artur 


-- 
View this message in context: http://www.nabble.com/camel-jetty-multithreading-in-multicast-tp18571306s22882p18571306.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel jetty multithreading in multicast

Posted by arturs <ar...@gmail.com>.

willem.jiang wrote:
> 
> You need set the ThreadPoolExecutor 
> <http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html> 
> youself for really parallel processing.
> I just wrote a Blog[1] for it last month, please check it out.
> 
> [1] http://willem.bokeland.com/blog/794/13758/2008/06/06/359442
> 
> Willem.
> 

Thanks,
This is what I was looking for. My route works now as I expected.
Artur
-- 
View this message in context: http://www.nabble.com/camel-jetty-multithreading-in-multicast-tp18571306s22882p18587450.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel jetty multithreading in multicast

Posted by Willem Jiang <wi...@gmail.com>.
You need set the ThreadPoolExecutor 
<http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html> 
youself for really parallel processing.
I just wrote a Blog[1] for it last month, please check it out.

[1] http://willem.bokeland.com/blog/794/13758/2008/06/06/359442

Willem.


arturs wrote:
> Hi,
> I need some help. I spent few days googling and debugging but was unable to
> find solution for my problem. Please clarify me it what i found is the
> camel's desired behavior (Camel 1.3 deployed in IONA Fuse service mix) or a
> bug. If this is not a bug , i would be grateful for any hints.
>
> I have the following configuration:
>
> private static final String PARAllEL_PROCESSING_POINT = "direct:mainflow";
>
>
> 	from("jetty:http://localhost:8999/my).convertBodyTo(String.class)
> 			.to("log:incomingRequest")
> 			.to(PARALLEL_PROCESSING_POINT)
> 			.to("log:after mainflow");
> 					
> 		
> 		from(PARALLEL_PROCESSING_POINT)
> 		.multicast(parallelFlowAggregationStrategy,true)
> 		.to(“log: first”,”log: second”);
>
> Jetty is my entry point to which I send xml requests. I'm using jmeter to
> send requests in multiple threads at once. When I set multicast to fork into
> subflows I keep getting :
>
>
> ERROR - DeadLetterChannel              - Failed delivery for exchangeId:
> ID-S205410J4462164/3125-1216299226744/0-0. On delivery attempt: 0 caught:
> java.util.concurrent.RejectedExecutionException
> java.util.concurrent.RejectedExecutionException
> 	at
> org.apache.camel.processor.MulticastProcessor$2.rejectedExecution(MulticastProcessor.java:231)
> 	at
> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
> 	at
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658)
> 	at
> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:164)
> 	at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
> 	at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:146)
> 	at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:90)
> 	at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:53)
> 	at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:67)
> 	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:73)
> 	at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:146)
> 	at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:90)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
> 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
> 	at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
> 	at
> org.apache.camel.component.jetty.CamelContinuationServlet.service(CamelContinuationServlet.java:66)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> 	at org.mortbay.jetty.Server.handle(Server.java:324)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
> 	at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
> 	at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
> 	at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
>
>
> The more threads I  start the more often exception occurs. It works hen I
> disable forking for multicast.  I tried to resolve this problem by setting
> threads(..) just after jetty , but this didn't work because there were messy
> responses back on jetty(another issue?? ) . This is just an example. The
> real life application's flow is much more complicated and for performance
> reasons i would like to use parallel processing wherever possible.
>
> Any suggestions?
>
> Kind regards.
> Artur 
>
>
>