You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andrew Clark <an...@hotmail.com> on 2014/10/17 10:59:39 UTC

Initial call response times



Hi,
We have recently started using CXF(2.7.12)  to develop REST services. After testing some of these services we have started to notice that the initial request has a much larger response time than subsequent request.
After some initial investigation we have been unable to identify what might be causing the issue and how to fix it.
Any help would be appreciated
thanksAndy
 		 	   		  

Re: Initial call response times

Posted by Sergey Beryozkin <sb...@gmail.com>.
I guess even a non JAXB Jackson provider has some initialization cost 
(checking Jackson annotations in the data model, etc)

Cheers, Sergey
On 17/10/14 13:42, Sergey Beryozkin wrote:
> Hi
> On 17/10/14 13:36, Andrew Clark wrote:
>> Hi Sergey,
>> We are actually using jackson as our json provider not the default
>> jettison. Would I be correct in thinking we cannot register the
>> org.apache.cxf.jaxrs.provider.JAXBElementProvider if we are not using
>> the default provider?
>> And I assume this would have no effect on the interceptor
>> initialisation issue either way?
> No, unless you use JacksonJaxbProvider which I'd assume also does the
> JAXB context initialization
>
> Cheers, Sergey
>
>> thanksAndy
>>
>>> Date: Fri, 17 Oct 2014 12:28:50 +0100
>>> From: sberyozkin@gmail.com
>>> To: users@cxf.apache.org
>>> Subject: Re: Initial call response times
>>>
>>> Hi
>>> On 17/10/14 12:07, Andrew Clark wrote:
>>>> Hi Sergey,
>>>> Thanks for the reply.
>>>> 1) Looking through our logs it seems a lot of the time for the first
>>>> call is spent initialise the interceptor chain. I have seen this
>>>> thread and it seems like this is normal behaviour
>>>> http://cxf.547215.n5.nabble.com/Slow-response-time-only-on-the-first-request-td2268844.html.
>>>> The thread is a few years old though so wondered if there was
>>>> someway to initialise the chain on startup?
>>>> 2) I am a little confused on how I would configure the
>>>> JAXBElementProvider to load on startup. Could you elaborate a little?
>>> See
>>>
>>> http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-SingleJAXBContextandextrauserclasses
>>>
>>>
>>> Setting those properties will instruct the provider to check the
>>> resources classes at the initialization time;
>>>
>>> Cheers, Sergey
>>>
>>>> thanks again
>>>> Andy
>>>>
>>>>
>>>>> Date: Fri, 17 Oct 2014 10:32:52 +0100
>>>>> From: sberyozkin@gmail.com
>>>>> To: users@cxf.apache.org
>>>>> Subject: Re: Initial call response times
>>>>>
>>>>> Hi
>>>>> On 17/10/14 09:59, Andrew Clark wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> Hi,
>>>>>> We have recently started using CXF(2.7.12)  to develop REST
>>>>>> services. After testing some of these services we have started to
>>>>>> notice that the initial request has a much larger response time
>>>>>> than subsequent request.
>>>>>> After some initial investigation we have been unable to identify
>>>>>> what might be causing the issue and how to fix it.
>>>>>> Any help would be appreciated
>>>>> Can it be just a regular 'warm-up' thing ?
>>>>> If you use CXF on the client side then the initial delay may be due to
>>>>> WebClient initialization. On the server side the initial delay may be
>>>>> caused by a dynamic JAXB context initialization which can be
>>>>> expensive,
>>>>> you can configure JAXBElementProvider to prepare JAXB contexts at the
>>>>> start up...
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>>> thanksAndy
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: Initial call response times

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 17/10/14 13:36, Andrew Clark wrote:
> Hi Sergey,
> We are actually using jackson as our json provider not the default jettison. Would I be correct in thinking we cannot register the org.apache.cxf.jaxrs.provider.JAXBElementProvider if we are not using the default provider?
> And I assume this would have no effect on the interceptor initialisation issue either way?
No, unless you use JacksonJaxbProvider which I'd assume also does the 
JAXB context initialization

Cheers, Sergey

> thanksAndy
>
>> Date: Fri, 17 Oct 2014 12:28:50 +0100
>> From: sberyozkin@gmail.com
>> To: users@cxf.apache.org
>> Subject: Re: Initial call response times
>>
>> Hi
>> On 17/10/14 12:07, Andrew Clark wrote:
>>> Hi Sergey,
>>> Thanks for the reply.
>>> 1) Looking through our logs it seems a lot of the time for the first call is spent initialise the interceptor chain. I have seen this thread and it seems like this is normal behaviour http://cxf.547215.n5.nabble.com/Slow-response-time-only-on-the-first-request-td2268844.html. The thread is a few years old though so wondered if there was someway to initialise the chain on startup?
>>> 2) I am a little confused on how I would configure the JAXBElementProvider to load on startup. Could you elaborate a little?
>> See
>>
>> http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-SingleJAXBContextandextrauserclasses
>>
>> Setting those properties will instruct the provider to check the
>> resources classes at the initialization time;
>>
>> Cheers, Sergey
>>
>>> thanks again
>>> Andy
>>>
>>>
>>>> Date: Fri, 17 Oct 2014 10:32:52 +0100
>>>> From: sberyozkin@gmail.com
>>>> To: users@cxf.apache.org
>>>> Subject: Re: Initial call response times
>>>>
>>>> Hi
>>>> On 17/10/14 09:59, Andrew Clark wrote:
>>>>>
>>>>>
>>>>>
>>>>> Hi,
>>>>> We have recently started using CXF(2.7.12)  to develop REST services. After testing some of these services we have started to notice that the initial request has a much larger response time than subsequent request.
>>>>> After some initial investigation we have been unable to identify what might be causing the issue and how to fix it.
>>>>> Any help would be appreciated
>>>> Can it be just a regular 'warm-up' thing ?
>>>> If you use CXF on the client side then the initial delay may be due to
>>>> WebClient initialization. On the server side the initial delay may be
>>>> caused by a dynamic JAXB context initialization which can be expensive,
>>>> you can configure JAXBElementProvider to prepare JAXB contexts at the
>>>> start up...
>>>>
>>>> Cheers, Sergey
>>>>
>>>>> thanksAndy
>>>>>     		 	   		
>>>>>
>>>>
>>>    		 	   		
>>>
>>
>   		 	   		
>


RE: Initial call response times

Posted by Andrew Clark <an...@hotmail.com>.
Hi Sergey,
We are actually using jackson as our json provider not the default jettison. Would I be correct in thinking we cannot register the org.apache.cxf.jaxrs.provider.JAXBElementProvider if we are not using the default provider?
And I assume this would have no effect on the interceptor initialisation issue either way?
thanksAndy

> Date: Fri, 17 Oct 2014 12:28:50 +0100
> From: sberyozkin@gmail.com
> To: users@cxf.apache.org
> Subject: Re: Initial call response times
> 
> Hi
> On 17/10/14 12:07, Andrew Clark wrote:
> > Hi Sergey,
> > Thanks for the reply.
> > 1) Looking through our logs it seems a lot of the time for the first call is spent initialise the interceptor chain. I have seen this thread and it seems like this is normal behaviour http://cxf.547215.n5.nabble.com/Slow-response-time-only-on-the-first-request-td2268844.html. The thread is a few years old though so wondered if there was someway to initialise the chain on startup?
> > 2) I am a little confused on how I would configure the JAXBElementProvider to load on startup. Could you elaborate a little?
> See
> 
> http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-SingleJAXBContextandextrauserclasses
> 
> Setting those properties will instruct the provider to check the 
> resources classes at the initialization time;
> 
> Cheers, Sergey
> 
> > thanks again
> > Andy
> >
> >
> >> Date: Fri, 17 Oct 2014 10:32:52 +0100
> >> From: sberyozkin@gmail.com
> >> To: users@cxf.apache.org
> >> Subject: Re: Initial call response times
> >>
> >> Hi
> >> On 17/10/14 09:59, Andrew Clark wrote:
> >>>
> >>>
> >>>
> >>> Hi,
> >>> We have recently started using CXF(2.7.12)  to develop REST services. After testing some of these services we have started to notice that the initial request has a much larger response time than subsequent request.
> >>> After some initial investigation we have been unable to identify what might be causing the issue and how to fix it.
> >>> Any help would be appreciated
> >> Can it be just a regular 'warm-up' thing ?
> >> If you use CXF on the client side then the initial delay may be due to
> >> WebClient initialization. On the server side the initial delay may be
> >> caused by a dynamic JAXB context initialization which can be expensive,
> >> you can configure JAXBElementProvider to prepare JAXB contexts at the
> >> start up...
> >>
> >> Cheers, Sergey
> >>
> >>> thanksAndy
> >>>    		 	   		
> >>>
> >>
> >   		 	   		
> >
> 
 		 	   		  

Re: Initial call response times

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 17/10/14 12:07, Andrew Clark wrote:
> Hi Sergey,
> Thanks for the reply.
> 1) Looking through our logs it seems a lot of the time for the first call is spent initialise the interceptor chain. I have seen this thread and it seems like this is normal behaviour http://cxf.547215.n5.nabble.com/Slow-response-time-only-on-the-first-request-td2268844.html. The thread is a few years old though so wondered if there was someway to initialise the chain on startup?
> 2) I am a little confused on how I would configure the JAXBElementProvider to load on startup. Could you elaborate a little?
See

http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-SingleJAXBContextandextrauserclasses

Setting those properties will instruct the provider to check the 
resources classes at the initialization time;

Cheers, Sergey

> thanks again
> Andy
>
>
>> Date: Fri, 17 Oct 2014 10:32:52 +0100
>> From: sberyozkin@gmail.com
>> To: users@cxf.apache.org
>> Subject: Re: Initial call response times
>>
>> Hi
>> On 17/10/14 09:59, Andrew Clark wrote:
>>>
>>>
>>>
>>> Hi,
>>> We have recently started using CXF(2.7.12)  to develop REST services. After testing some of these services we have started to notice that the initial request has a much larger response time than subsequent request.
>>> After some initial investigation we have been unable to identify what might be causing the issue and how to fix it.
>>> Any help would be appreciated
>> Can it be just a regular 'warm-up' thing ?
>> If you use CXF on the client side then the initial delay may be due to
>> WebClient initialization. On the server side the initial delay may be
>> caused by a dynamic JAXB context initialization which can be expensive,
>> you can configure JAXBElementProvider to prepare JAXB contexts at the
>> start up...
>>
>> Cheers, Sergey
>>
>>> thanksAndy
>>>    		 	   		
>>>
>>
>   		 	   		
>


RE: Initial call response times

Posted by Andrew Clark <an...@hotmail.com>.
Hi Sergey,
Thanks for the reply.
1) Looking through our logs it seems a lot of the time for the first call is spent initialise the interceptor chain. I have seen this thread and it seems like this is normal behaviour http://cxf.547215.n5.nabble.com/Slow-response-time-only-on-the-first-request-td2268844.html. The thread is a few years old though so wondered if there was someway to initialise the chain on startup?
2) I am a little confused on how I would configure the JAXBElementProvider to load on startup. Could you elaborate a little?
thanks again
Andy


> Date: Fri, 17 Oct 2014 10:32:52 +0100
> From: sberyozkin@gmail.com
> To: users@cxf.apache.org
> Subject: Re: Initial call response times
> 
> Hi
> On 17/10/14 09:59, Andrew Clark wrote:
> >
> >
> >
> > Hi,
> > We have recently started using CXF(2.7.12)  to develop REST services. After testing some of these services we have started to notice that the initial request has a much larger response time than subsequent request.
> > After some initial investigation we have been unable to identify what might be causing the issue and how to fix it.
> > Any help would be appreciated
> Can it be just a regular 'warm-up' thing ?
> If you use CXF on the client side then the initial delay may be due to 
> WebClient initialization. On the server side the initial delay may be 
> caused by a dynamic JAXB context initialization which can be expensive, 
> you can configure JAXBElementProvider to prepare JAXB contexts at the 
> start up...
> 
> Cheers, Sergey
> 
> > thanksAndy
> >   		 	   		
> >
> 
 		 	   		  

Re: Initial call response times

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 17/10/14 09:59, Andrew Clark wrote:
>
>
>
> Hi,
> We have recently started using CXF(2.7.12)  to develop REST services. After testing some of these services we have started to notice that the initial request has a much larger response time than subsequent request.
> After some initial investigation we have been unable to identify what might be causing the issue and how to fix it.
> Any help would be appreciated
Can it be just a regular 'warm-up' thing ?
If you use CXF on the client side then the initial delay may be due to 
WebClient initialization. On the server side the initial delay may be 
caused by a dynamic JAXB context initialization which can be expensive, 
you can configure JAXBElementProvider to prepare JAXB contexts at the 
start up...

Cheers, Sergey

> thanksAndy
>   		 	   		
>