You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by snormanll <se...@londonlife.com> on 2014/03/17 19:33:10 UTC

Camel CXF Endpoint Performance - Threading

We're running load tests against a Web application that invokes a Web service
that's exposed via Camel CXF and have run into performance issues with the
Camel/CXF component.

Through the help of AppDynamics, we've identified the culprit as being the
Camel AsyncProcessorHelper.proccess() method...specifically, the line of
code where it's waiting for some type of latch to be released (line 121 of
org.apache.camel.util.AsyncProcessorHelper, camel core v2.12.2). I assume
this is being done in order to synchronize some internal operation.

The route is pretty basic, and I assume it's getting stuck before it even
gets to the "meat" of the Camel route. I've cut out a lot of the detail and
changes some of the names being used below, but here's the gist:

/

<cxf:cxfEndpoint id="inquiry"
   address="${inquiry.contextpath}"
   >...
</cxf:cxfEndpoint>
...


<camel:route id="InquiryCxfRoute">
  <camel:from uri="cxf:bean:inquiry?  />
  <camel:to uri="direct:InquiryChannel" pattern="InOut" />
</camel:route>
...

<camel:route id="InquiryRoute">
   <camel:from uri="direct:InquiryChannel" />
    ...
/

In some cases it's taking upwards of 30 seconds for the latch.await() method
to return. I'm wondering if we need to tune our threading model, but I don't
quite understand what's going on under the covers with this CXF client
route.

Can anybody shed some light on some of the internal details?




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Endpoint-Performance-Threading-tp5748984.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF Endpoint Performance - Threading

Posted by snormanll <se...@londonlife.com>.
Thanks Willem.

The InquiryRoute constructs the data that needs to be returned by the Web
Service call (accomplished in a POJO) so the operation cannot be performed
asynchronously (i.e. the caller is waiting for a response).

The reason I put the main logic in a separate route is that I wanted to plan
for the possibility of multiple front-ends to the service (i.e. JAXWS,
JAXRS, JMS, etc.). In this case, all of the front-ends would forward their
messages to the InquiryRoute. I'm assuming that this is a valid pattern, or
would it be best to put the logic inline for each front-end?

I noticed that the CXF component has an attribute called /synchronous/ which
is set to false by default. Should it bet set to true for the scenario that
I'm trying to accomplish?






--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Endpoint-Performance-Threading-tp5748984p5749098.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF Endpoint Performance - Threading

Posted by Willem Jiang <wi...@gmail.com>.
You can use Jetty transport as workaround by setting the CXF endpoint address like this
“http://YOUR_HOST_IP:ANOTHER_PORT/service/address" 

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 19, 2014 at 9:49:16 PM, snormanll (sean.norman@londonlife.com) wrote:
> Are you saying that the container is the issue, and that if we deploy to a
> container that supports servlet spec v3.0 the issue will go away?
>  
> If so, are there any strategies you can suggest for resolving the issue in
> older containers?
>  
> Thanks.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Endpoint-Performance-Threading-tp5748984p5749101.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: Camel CXF Endpoint Performance - Threading

Posted by snormanll <se...@londonlife.com>.
Are you saying that the container is the issue, and that if we deploy to a
container that supports servlet spec v3.0 the issue will go away?

If so, are there any strategies you can suggest for resolving the issue in
older containers?

Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Endpoint-Performance-Threading-tp5748984p5749101.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF Endpoint Performance - Threading

Posted by Willem Jiang <wi...@gmail.com>.
Hi 

It looks like you deploy the camel route into websphere.
CXF support the servlet continuation if the servlet container supports Servlet 3.0.
In that way CXF consumer uses the async invocation which doesn't block the worker thread any more.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 19, 2014 at 8:07:56 PM, snormanll (sean.norman@londonlife.com) wrote:
> Here's a sample stack trace for a slow transaction:
>  
> /
> com.ibm.ws.util.ThreadPool$Worker:run:1646 (method time = 0 ms, total time =
> 28492 ms)
> org.apache.cxf.transport.servlet.AbstractHTTPServlet:service:262 (method  
> time = 0 ms, total time = 28492 ms)
> HTTPServlet:service:738 (method time = 0 ms, total time = 28492 ms)
> org.apache.cxf.transport.servlet.AbstractHTTPServlet:doPost:206 (method
> time = 0 ms, total time = 28492 ms)
> org.apache.cxf.transport.servlet.AbstractHTTPServlet:handleRequest:286
> (method time = 0 ms, total time = 28492 ms)
> org.apache.cxf.transport.servlet.CXFNonSpringServlet:invoke:167 (method
> time = 0 ms, total time = 28492 ms)
> org.apache.cxf.transport.servlet.ServletController:invoke:153 (method
> time = 0 ms, total time = 28492 ms)
> org.apache.cxf.transport.servlet.ServletController:invoke:222 (method
> time = 0 ms, total time = 28492 ms)
>  
> org.apache.cxf.transport.servlet.ServletController:invokeDestination:248  
> (method time = 0 ms, total time = 28492 ms)
> org.apache.cxf.transport.http.AbstractHTTPDestination:invoke:239
> (method time = 0 ms, total time = 28492 ms)
> org.apache.cxf.transport.ChainInitiationObserver:onMessage:121
> (method time = 0 ms, total time = 28492 ms)
> org.apache.cxf.phase.PhaseInterceptorChain:doIntercept:272
> (method time = 0 ms, total time = 28492 ms)
> Web Service -
> org.apache.cxf.interceptor.ServiceInvokerInterceptor:handleMessage:107
> (method time = 0 ms, total time = 28492 ms)
> org.apache.cxf.workqueue.SynchronousExecutor:execute:37 (method
> time = 0 ms, total time = 28492 ms)
> Proxy For Web Service -
> org.apache.cxf.interceptor.ServiceInvokerInterceptor:run:58 (method time =  
> 0
> ms, total time = 28492 ms)
> org.apache.camel.component.cxf.CxfConsumer$1:invoke:75
> (method time = 0 ms, total time = 28492 ms)
> org.apache.camel.component.cxf.CxfConsumer$1:syncInvoke:134
> (method time = 0 ms, total time = 28492 ms)
>  
> org.apache.camel.processor.DelegateAsyncProcessor:process:87 (method time  
> =
> 0 ms, total time = 28492 ms)
> org.apache.camel.util.AsyncProcessorHelper:process:121
> (method time = 28492 ms, total time = 28492 ms)
> /
>  
> The CXF proxy client classes we're using are generated from a WSDL using the
> maven "cxf-codegen-plugin" plugin. That would be the CXF bean being exposed
> as the service interface in the Camel route:
>  
>  
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Endpoint-Performance-Threading-tp5748984p5749099.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: Camel CXF Endpoint Performance - Threading

Posted by snormanll <se...@londonlife.com>.
Here's a sample stack trace for a slow transaction:

/
com.ibm.ws.util.ThreadPool$Worker:run:1646 (method time = 0 ms, total time =
28492 ms)
 org.apache.cxf.transport.servlet.AbstractHTTPServlet:service:262 (method
time = 0 ms, total time = 28492 ms)
  HTTPServlet:service:738 (method time = 0 ms, total time = 28492 ms)
   org.apache.cxf.transport.servlet.AbstractHTTPServlet:doPost:206 (method
time = 0 ms, total time = 28492 ms)
    org.apache.cxf.transport.servlet.AbstractHTTPServlet:handleRequest:286
(method time = 0 ms, total time = 28492 ms)
     org.apache.cxf.transport.servlet.CXFNonSpringServlet:invoke:167 (method
time = 0 ms, total time = 28492 ms)
      org.apache.cxf.transport.servlet.ServletController:invoke:153 (method
time = 0 ms, total time = 28492 ms)
       org.apache.cxf.transport.servlet.ServletController:invoke:222 (method
time = 0 ms, total time = 28492 ms)
       
org.apache.cxf.transport.servlet.ServletController:invokeDestination:248
(method time = 0 ms, total time = 28492 ms)
         org.apache.cxf.transport.http.AbstractHTTPDestination:invoke:239
(method time = 0 ms, total time = 28492 ms)
          org.apache.cxf.transport.ChainInitiationObserver:onMessage:121
(method time = 0 ms, total time = 28492 ms)
           org.apache.cxf.phase.PhaseInterceptorChain:doIntercept:272
(method time = 0 ms, total time = 28492 ms)
            Web Service -
org.apache.cxf.interceptor.ServiceInvokerInterceptor:handleMessage:107
(method time = 0 ms, total time = 28492 ms)
             org.apache.cxf.workqueue.SynchronousExecutor:execute:37 (method
time = 0 ms, total time = 28492 ms)
              Proxy For Web Service -
org.apache.cxf.interceptor.ServiceInvokerInterceptor:run:58 (method time = 0
ms, total time = 28492 ms)
               org.apache.camel.component.cxf.CxfConsumer$1:invoke:75
(method time = 0 ms, total time = 28492 ms)
                org.apache.camel.component.cxf.CxfConsumer$1:syncInvoke:134
(method time = 0 ms, total time = 28492 ms)
                
org.apache.camel.processor.DelegateAsyncProcessor:process:87 (method time =
0 ms, total time = 28492 ms)
                  org.apache.camel.util.AsyncProcessorHelper:process:121
(method time = 28492 ms, total time = 28492 ms)
/

The CXF proxy client classes we're using are generated from a WSDL using the
maven "cxf-codegen-plugin" plugin. That would be the CXF bean being exposed
as the service interface in the Camel route:

<cxf:cxfEndpoint id="Inquiry"> 




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Endpoint-Performance-Threading-tp5748984p5749099.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF Endpoint Performance - Threading

Posted by "Willem.Jiang" <wi...@gmail.com>.
Hi,

The AsyncProcessorHelper.proccess() method just provides a sync processing
invocation  which is based on the Async API. I need to know some detail
about your route which makes camel does that change.
 
It looks like you are using direct endpoint to route the message to next
camel route, as the direct endpoint provides the async API and CXF consumer
is using async API by default, so I doubt your InquiryRoute may have some
endpoint which just can call the sync process API.

You can use seda endpoint to replace direct endpoint to decouple the threads
from the InquiryCxfRoute and InquiryRoute. 

Regards,

Willem



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Endpoint-Performance-Threading-tp5748984p5749074.html
Sent from the Camel - Users mailing list archive at Nabble.com.