camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: CxfRsProducer is not thread safe
Date Mon, 23 Jul 2012 22:16:23 GMT
Hi
On 23/07/12 17:38, dumi_p wrote:
> Hi all,
>
> I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test following
> scenario:
>
> 1. Have a CXF rest service deployed
> 2. Have a proxy CXF rest service over the service above, deployed under the
> same Camel instance
>
> It works fine, until I perform requests in parallel. Exception stacktrace is
> attached.  http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt
> stacktrace.txt
>
> I tried following things in class
> org.apache.camel.component.cxf.jaxrs.CxfRsProducer order to fix it:
> 1. Invoked JAXRSClientFactoryBean.setThreadSafe(true), with no success
> 2. Added synchronization point over line WebClient client =
> cfb.createWebClient(), from invokeHttpClient method. It works, but
> performance dropped on my localhost from 150 requests per second to 10
> requests per second, so the fix is not acceptable.
>
> I attach my camel-config.xml - please let me know if additional info is
> needed. http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
> camel-config.xml
>
> I am not sure if the problem lies in the configuration I performed or in the
> cxf-rs component or in cxf itself.
>
> Any idea is appreciated.
>
Well,I look at the code and see some JAXRSClientFactoryBean cache - 
Willem can you comment on this please ? This looks suspicious.
The trace shows that the thread safety is compromised at the point of 
creating web clients. I can work on a patch - though will take me a bit 
of time to get to it

Dumitru - any chance you can declare jaxrs:client or WebClient [1,2] 
explicitly, with a thread safe flag set and reuse it in the routes 
directly ? That should do it.

Thanks
Sergey

[1] 
http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring
[2] 
http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring


[2]

> Best regards,
> Dumitru
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message