You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Cheng <ch...@gmail.com> on 2009/03/16 12:26:07 UTC

slow performance of DOM parsing in CXF

I found out that the slow performance of creating ports in CXF is due to DOM
XML parsing.

In the class "org.apache.cxf.wsdl11.SchemaUtil", the following line in
function "extractSchema(Definition def, SchemaCollection schemaCol,
List<SchemaInfo> schemaInfos)" takes more than 20 seconds to read the schema
XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);

In the class "org.apache.cxf.wsdl11.WSDLManagerImpl", the following line in
function "loadDefinition(String url)" takes another 10 seconds to read WSDL,
obviously it using wsdl4j which is also using DOM for XML parsing.
Definition def = reader.readWSDL(wsdlLocator);

Is it possible to switch to SAX for XML parsing instead of DOM??

Re: slow performance of DOM parsing in CXF

Posted by Daniel Kulp <dk...@apache.org>.
What version of XmlSchema jar are you picking up?    I know this area was 
REALLY bad in <=1.4.2.   WIth 1.4.3, we did add some namespace context caching 
which has helped tremendously.   

I would like to switch XmlSchema to  more of a Stax based parsing, but it's 
quite a bit of work that we haven't had time to really investigate.  The 
namespace context caching is kind of a "band aid" that make it a bit more 
tolerable, but still not ideal.

Not much we can do about the wsdl4j stuff though.   

Dan


On Mon March 16 2009 7:26:07 am Christopher Cheng wrote:
> I found out that the slow performance of creating ports in CXF is due to
> DOM XML parsing.
>
> In the class "org.apache.cxf.wsdl11.SchemaUtil", the following line in
> function "extractSchema(Definition def, SchemaCollection schemaCol,
> List<SchemaInfo> schemaInfos)" takes more than 20 seconds to read the
> schema XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
>
> In the class "org.apache.cxf.wsdl11.WSDLManagerImpl", the following line in
> function "loadDefinition(String url)" takes another 10 seconds to read
> WSDL, obviously it using wsdl4j which is also using DOM for XML parsing.
> Definition def = reader.readWSDL(wsdlLocator);
>
> Is it possible to switch to SAX for XML parsing instead of DOM??

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: slow performance of DOM parsing in CXF

Posted by Christopher Cheng <ch...@gmail.com>.
about 0.5MB in total

On Tue, Mar 17, 2009 at 8:56 AM, Benson Margulies <bi...@gmail.com>wrote:

> How big are they?
>
> On Mon, Mar 16, 2009 at 8:45 PM, Christopher Cheng
>  <ch...@gmail.com> wrote:
> > All XSD and WSDL are local
> >
> > On Mon, Mar 16, 2009 at 7:58 PM, Benson Margulies <bimargulies@gmail.com
> >wrote:
> >
> >> The simple answer is 'no.'.
> >>
> >> This sounds to me more like network latency trying to include external
> >> schema than parsing time.
> >>
> >>
> >> On Mon, Mar 16, 2009 at 7:26 AM, Christopher Cheng
> >> <ch...@gmail.com> wrote:
> >> > I found out that the slow performance of creating ports in CXF is due
> to
> >> DOM
> >> > XML parsing.
> >> >
> >> > In the class "org.apache.cxf.wsdl11.SchemaUtil", the following line in
> >> > function "extractSchema(Definition def, SchemaCollection schemaCol,
> >> > List<SchemaInfo> schemaInfos)" takes more than 20 seconds to read the
> >> schema
> >> > XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
> >> >
> >> > In the class "org.apache.cxf.wsdl11.WSDLManagerImpl", the following
> line
> >> in
> >> > function "loadDefinition(String url)" takes another 10 seconds to read
> >> WSDL,
> >> > obviously it using wsdl4j which is also using DOM for XML parsing.
> >> > Definition def = reader.readWSDL(wsdlLocator);
> >> >
> >> > Is it possible to switch to SAX for XML parsing instead of DOM??
> >> >
> >>
> >
>

Re: slow performance of DOM parsing in CXF

Posted by Benson Margulies <bi...@gmail.com>.
How big are they?

On Mon, Mar 16, 2009 at 8:45 PM, Christopher Cheng
<ch...@gmail.com> wrote:
> All XSD and WSDL are local
>
> On Mon, Mar 16, 2009 at 7:58 PM, Benson Margulies <bi...@gmail.com>wrote:
>
>> The simple answer is 'no.'.
>>
>> This sounds to me more like network latency trying to include external
>> schema than parsing time.
>>
>>
>> On Mon, Mar 16, 2009 at 7:26 AM, Christopher Cheng
>> <ch...@gmail.com> wrote:
>> > I found out that the slow performance of creating ports in CXF is due to
>> DOM
>> > XML parsing.
>> >
>> > In the class "org.apache.cxf.wsdl11.SchemaUtil", the following line in
>> > function "extractSchema(Definition def, SchemaCollection schemaCol,
>> > List<SchemaInfo> schemaInfos)" takes more than 20 seconds to read the
>> schema
>> > XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
>> >
>> > In the class "org.apache.cxf.wsdl11.WSDLManagerImpl", the following line
>> in
>> > function "loadDefinition(String url)" takes another 10 seconds to read
>> WSDL,
>> > obviously it using wsdl4j which is also using DOM for XML parsing.
>> > Definition def = reader.readWSDL(wsdlLocator);
>> >
>> > Is it possible to switch to SAX for XML parsing instead of DOM??
>> >
>>
>

Re: slow performance of DOM parsing in CXF

Posted by Christopher Cheng <ch...@gmail.com>.
All XSD and WSDL are local

On Mon, Mar 16, 2009 at 7:58 PM, Benson Margulies <bi...@gmail.com>wrote:

> The simple answer is 'no.'.
>
> This sounds to me more like network latency trying to include external
> schema than parsing time.
>
>
> On Mon, Mar 16, 2009 at 7:26 AM, Christopher Cheng
> <ch...@gmail.com> wrote:
> > I found out that the slow performance of creating ports in CXF is due to
> DOM
> > XML parsing.
> >
> > In the class "org.apache.cxf.wsdl11.SchemaUtil", the following line in
> > function "extractSchema(Definition def, SchemaCollection schemaCol,
> > List<SchemaInfo> schemaInfos)" takes more than 20 seconds to read the
> schema
> > XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
> >
> > In the class "org.apache.cxf.wsdl11.WSDLManagerImpl", the following line
> in
> > function "loadDefinition(String url)" takes another 10 seconds to read
> WSDL,
> > obviously it using wsdl4j which is also using DOM for XML parsing.
> > Definition def = reader.readWSDL(wsdlLocator);
> >
> > Is it possible to switch to SAX for XML parsing instead of DOM??
> >
>

Re: slow performance of DOM parsing in CXF

Posted by Benson Margulies <bi...@gmail.com>.
The simple answer is 'no.'.

This sounds to me more like network latency trying to include external
schema than parsing time.


On Mon, Mar 16, 2009 at 7:26 AM, Christopher Cheng
<ch...@gmail.com> wrote:
> I found out that the slow performance of creating ports in CXF is due to DOM
> XML parsing.
>
> In the class "org.apache.cxf.wsdl11.SchemaUtil", the following line in
> function "extractSchema(Definition def, SchemaCollection schemaCol,
> List<SchemaInfo> schemaInfos)" takes more than 20 seconds to read the schema
> XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
>
> In the class "org.apache.cxf.wsdl11.WSDLManagerImpl", the following line in
> function "loadDefinition(String url)" takes another 10 seconds to read WSDL,
> obviously it using wsdl4j which is also using DOM for XML parsing.
> Definition def = reader.readWSDL(wsdlLocator);
>
> Is it possible to switch to SAX for XML parsing instead of DOM??
>