As David said, I expect this is "normal".   Along with general classloading 
slowdowns (and the class validation/verification that entails) that he 
mentioned, there are a bunch of other things that would be part of this:

1) Phase chain - CXF calculates the chain on the first request and caches it.   
On subsequent requests, if nothing has changed (no-one added an interceptor 
programatically anywhere), it just clones it. 

2) Wrapper helpers and such - the first time a wrapper object is used, we use 
some reflection and ASM and such to create a helper object for dealing with 
the wrapper object.  Those are cached for later.

3) Likewise, JAXB does a BUNCH of things to inject special setter/getter 
methods and such into the classes it hits to speed up it's operations.

4) JIT - this is also a big one.   As things go along, things may hit a 
threshold where the JIT will start compiling things.   In the first request, 
nothing (or very little) may hit that threshold but in subsequent requests, it 
might.  For example, a call to "getElementName()" on the XMLStreamReader 
classes may not hit the magic in the first (or even second) request and then 
get sped up later.   

There's definitely a lot of other things like that that go on. 

Dan





On Monday 09 August 2010 9:47:21 am Mariano Ortega wrote:
> Hi,
> 
> I'm working on a project where we have decided to start given access to our
> core functionality thru Web Services. After some research we choosen Apache
> CXF.
> During my analysis, everything works fine. I was deploying the test
> services on a Jetty without Spring Support (CXFNonSpringServlet).
> 
> Now, the problem arouse when I deployed the same code on a Weblogic server.
> The issue is that the FIRST coming request takes lot of time (~7 seconds)
> and the subsequent ones take times <70 msec.
> 
> I was some kinda confused about this behaviour, it would make sense a small
> increase in the first request 4 times at most but not some kinda this
> magnitude (100 times).
> 
> I've changed the log level to FINEST and I'm seeing that this is happening
> the First time the Interceptor Chain is called (invoke to handleMessage on
> each input and output interceptors) -- see lines 892 to 1069 of the
> attached zipped log file. When the next request is served -- see lines
> 1121 to 1274 -- this work pretty smooth.
> 
> Just in case, reducing the log level does not make things better (first
> request takes 6,5 seconds and next ones 30 msec)
> 
> Do you have any ideas of what could be happening and how can I fix it?
> 
> Thanks in advance,
> Mariano Ortega

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

Reply via email to