Hello
We are using CXF to implement low response time XML services.
We noticed, since 1.5 year now, that we the usage of our XML service is
increasing, the CXF framework does not seem to scale under certain
condition.
We tried as much as possible to understand how to get the best of CXF but
today, it seems we are kind of stuck and think that this scaling
issue could be fixed in CXF.
Our problem is related to the usage of XmlAnyElement in JAXB mappings.
Everything is running fine when the input XML does not trigger the catchall
process of our grammars,
but once the catch all is triggered the application is not able to scale if
all input XML contain an "unknown element".
We use this mechanism to have a kind of forward compatilibity of our
grammars : catching all unknown elements is part of this forward
compatibility.
What's the issue then with XmlAnyelement?
We have a catchall inside of our custom soap header, i.e:
@XmlRootElement
public class OurSoapHeader {
// ....
@XmlAnyElement
List importantTechnicalData
// ...
The transformation of OurSoapHeader to JaxB is started in
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor, when the
Jaxb unmarshaller encounters
the wildcard element, it kicks out XML factories for parsing and
transforming : there's an attached flamegraph showing the time consumed as
per creation of that.
XmlTransformersFG.png
<http://cxf.547215.n5.nabble.com/file/t341788/XmlTransformersFG.png>
You can see the implementation of Jaxb here :
https://github.com/javaee/jaxb-v2/blob/master/jaxb-ri/runtime/impl/src/main/java/com/sun/xml/bind/v2/runtime/unmarshaller/DomLoader.java#L75-L84
that triggers this specific use case.
The issue with this code is that there are synchronized blocks in a bunch of
Factories methods that implies a lot of contention when the traffic increase
on our servers, and prevent our application from scaling well.
We need a bit of help to sort out this issue, on your side, are you aware of
such problem ?
Do you have any idea on how to fix the behavior of CXF or Jaxb to avoid
creation of Factories ?
On my side I was thinking of having CXF maintaining a pool of JAXB
unmarshallers, do you know if it can solve this specific issue?
Regards
Kevin
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html