cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: JAX-RS and JIBX
Date Tue, 20 Mar 2012 16:06:23 GMT
Hi Kiren
On 20/03/12 14:47, Kiren Pillay wrote:
> Hi Sergey!
>
> We are using 2.5.2, sorry, I was looking at an old version of  the code:)
> Okay, if JAXBContext is cached, then there's no need for me to fiddle with
> it. I will try the woodstox setting as well.
>
I'm most likely going to make it using the woodstox writer by default. 
yea, can you try on your own please too and let me know if it makes a 
diff in your case

> I am not getting very good performance with my application for some reason.
> My application is
>
> Request-->Application --->  myResponse(with duration)
> -->JAXBElementProvider--->  CXF core code --->  Client.
>
> A
> B
> What I'm seeing is that between A and B there is a time gap of maybe
> 100ms.  I have tested JAXB Unmarshalling of the same packet in a standalone
> test app and the time was 10ms. So somewhere thereafter I'm losing some
> time. Any ideas?

So writing a 27K+ on the server side and reading it on the client side 
is 10 times slower with CXF (JAX-RS) than with the simple client-server 
app using plain JAXB ? Is it CXF client by the way ?

Cheers, Sergey

>
> Regards
> Kiren
>
> On Mon, Mar 19, 2012 at 11:52 PM, Sergey Beryozkin<sberyozkin@gmail.com>wrote:
>
>> Hi Kirren
>>
>> What CXF version are you working with, is it 2.1.4 ?
>> JAXBContext is cached in the current implementation,
>> the other thing the Woodstox Stax reader is used under the hood by default
>> at the read time, and the (woodstox) writer can indirectly enabled by
>> setting a JAXBElementProvider 'enableStreaming' property -
>> this can be set to true by default
>>
>> Sergey
>>
>>
>> On 17/03/12 12:44, Kiren Pillay wrote:
>>
>>> Hi John,
>>>
>>> I am interested in the work you are doing. I am facing performance issues
>>> with JAXB with large payloads (27K responses). The marshalling in my
>>> experience looks like its 30-40% of the request time (for large packets).
>>>
>>> I am looking at the JAXBElementProvider class and notice that a potential
>>> bottleneck is that the JABConxtext is created with every request.
>>> Performance should improve dramatically if the context is intantiated once
>>> and reused.  I am going to try and see if I can create a new
>>> implementation
>>> of the  JAXBElemetProvider that does this.
>>>
>>> The following code refers.
>>>
>>> protected Marshaller
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/Marshaller.java#**Marshaller<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/Marshaller.java#Marshaller>
>>>>
>>>   <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>> **createMarshaller(Object
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/java/**lang/Object.java#Object<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/Object.java#Object>
>>>>
>>> obj, Class<http://grepcode.com/**file/repository.grepcode.com/**
>>> java/root/jdk/openjdk/6-b14/**java/lang/Class.java#Class<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/Class.java#Class>
>>>> <?>
>>> cls, Type<http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/java/**lang/reflect/Type.java#Type<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/reflect/Type.java#Type>
>>>>
>>> genericType, MediaType m)
>>>
>>>   192<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#192<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#192>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>          throws JAXBException
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/JAXBException.java#**
>>> JAXBException<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/JAXBException.java#JAXBException>
>>>>
>>> {
>>>
>>>   193<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#193<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#193>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>
>>>
>>>   194<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#194<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#194>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>          Class<http://grepcode.com/**file/repository.grepcode.com/**
>>> java/root/jdk/openjdk/6-b14/**java/lang/Class.java#Class<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/Class.java#Class>
>>>> <?>
>>> objClazz = JAXBElement
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/JAXBElement.java#**JAXBElement<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/JAXBElement.java#JAXBElement>
>>>> .class.**isAssignableFrom
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/java/**lang/Class.java#Class.**
>>> isAssignableFrom%28java.lang.**Class%29<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/Class.java#Class.isAssignableFrom%28java.lang.Class%29>
>>>> (cls)
>>>
>>>   195<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#195<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#195>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>                              ? ((JAXBElement
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/JAXBElement.java#**JAXBElement<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/JAXBElement.java#JAXBElement>
>>>> )obj).**getDeclaredType
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/JAXBElement.java#**
>>> JAXBElement.getDeclaredType%**28%29<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/JAXBElement.java#JAXBElement.getDeclaredType%28%29>
>>>> ()
>>> : cls;
>>>
>>>   196<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#196<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#196>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>          JAXBContext
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/JAXBContext.java#**JAXBContext<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/JAXBContext.java#JAXBContext>
>>>>
>>> context = getJAXBContext
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#**
>>> AbstractJAXBProvider.**getJAXBContext%28java.lang.**
>>> Class%2Cjava.lang.reflect.**Type%29<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#AbstractJAXBProvider.getJAXBContext%28java.lang.Class%2Cjava.lang.reflect.Type%29>
>>>> (objClazz,
>>> genericType);
>>>
>>>   197<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#197<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#197>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>          Marshaller
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/Marshaller.java#**Marshaller<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/Marshaller.java#Marshaller>
>>>>
>>> marshaller = context.createMarshaller
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/JAXBContext.java#**
>>> JAXBContext.createMarshaller%**28%29<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/JAXBContext.java#JAXBContext.createMarshaller%28%29>
>>>> ();
>>>
>>>   198<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#198<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#198>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>          String<http://grepcode.com/**file/repository.grepcode.com/**
>>> java/root/jdk/openjdk/6-b14/**java/lang/String.java#String<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/String.java#String>
>>>>
>>> enc = m.getParameters().get(CHARSET_**PARAMETER
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#**
>>> AbstractJAXBProvider.0CHARSET_**PARAMETER<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#AbstractJAXBProvider.0CHARSET_PARAMETER>
>>>> );
>>>
>>>   199<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#199<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#199>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>          if (enc != null) {
>>>
>>>   200<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#200<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#200>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>              marshaller.setProperty
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/Marshaller.java#**
>>> Marshaller.setProperty%28java.**lang.String%2Cjava.lang.**Object%29<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/Marshaller.java#Marshaller.setProperty%28java.lang.String%2Cjava.lang.Object%29>
>>>> (Marshaller
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/Marshaller.java#**
>>> Marshaller.0JAXB_ENCODING<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/Marshaller.java#Marshaller.0JAXB_ENCODING>
>>>> .**JAXB_ENCODING
>>> <http://grepcode.com/file/**repository.grepcode.com/java/**
>>> root/jdk/openjdk/6-b14/javax/**xml/bind/Marshaller.java#**
>>> Marshaller.0JAXB_ENCODING<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/javax/xml/bind/Marshaller.java#Marshaller.0JAXB_ENCODING>
>>>> ,
>>> enc);
>>>
>>>   201<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#201<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#201>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>          }
>>>
>>>   202<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#202<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#202>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>          return marshaller;
>>>
>>>   203<http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#203<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#203>
>>>>
>>>
>>> <http://grepcode.com/file/**repository.jboss.org/maven2/**
>>> org.apache.cxf/cxf-rt-**frontend-jaxrs/2.1.4/org/**
>>> apache/cxf/jaxrs/provider/**AbstractJAXBProvider.java#<http://grepcode.com/file/repository.jboss.org/maven2/org.apache.cxf/cxf-rt-frontend-jaxrs/2.1.4/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java#>
>>>>
>>>
>>>
>>>      }
>>>
>>>
>>> On Fri, Mar 16, 2012 at 9:20 PM, johnf<john.fansler@ateb.com>   wrote:
>>>
>>>   I tried configuring a jibx example up with the databinding configured
>>>> like
>>>> the systest examples. Unfortunately I get:
>>>>
>>>> Caused by: java.lang.**UnsupportedOperationException: Not Implemented
>>>>         at org.apache.cxf.jibx.**JibxDataReader.read(**
>>>> JibxDataReader.java:65)
>>>>
>>>> Maybe it's not quite ready for JAX-RS.
>>>>
>>>> Thanks for the advice,
>>>>
>>>> -john
>>>>
>>>> --
>>>> View this message in context:
>>>> http://cxf.547215.n5.nabble.**com/JAX-RS-and-JIBX-**
>>>> tp5571395p5572244.html<http://cxf.547215.n5.nabble.com/JAX-RS-and-JIBX-tp5571395p5572244.html>
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>

Mime
View raw message