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 Wed, 25 Jul 2012 16:41:07 GMT
As a sanity check I've run the multi-threaded test on the trunk and 
2.9.x due to diff CXF versions being used there, still things work OK.

Dumitru, I've been telling everyone CXF RS producer is broken :-), so 
need your help with reproducing the case. Are you having multiple 
threads running within a route builder itself ? Please provide more info

Sergey
On 25/07/12 14:44, Sergey Beryozkin wrote:
> Dumitru,
>
> I'm not seeing in
> http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
> how the route is initiated, can you provide the source of the updated
> org.apache.camel.example.cxf.CamelRoute ?
>
> I've updated one of the tests which Willem created to get 500 threads
> stressing the rs client code, can not reproduce the issue
>
> Cheers, Sergey
>
> On 24/07/12 02:45, Willem Jiang wrote:
>> On Tue, Jul 24, 2012 at 6:16 AM, Sergey
>> Beryozkin<sberyozkin@gmail.com>wrote:
>>
>>> 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<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<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.
>>>
>>
>> I don't like the JAXRSClientFactoryBean cache either, it is used to
>> create the WebClient if we change the URI per request. Now I just want to
>> ask if there is a way to override the server address by setting the
>> context
>> per request in the WebClient.
>>
>> If So , it could easy for use to resolve the issue.
>>
>>
>>> 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<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<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<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