You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by ajay bhadauria <ab...@yahoo.com> on 2008/10/31 21:50:41 UTC

xalan 2.7.1 performance issues

Hi,

I am doing xml validation using schema and transformation using xsl. All the schemas and stylesheets are stored in the memory (HashMap) at the time of initialization of my application. 

First, I used java 1.5.0.13 to validate xml document and also for transformation. First I do schema validation and then do transformation and measure CPU utilization

Second, I used java1.5.0.13 with xalan 2.7.1 with endorsed directory. Xalan jars files are put into the endorsed directory under lib directory of java home and used the -Djava.endorsed.dir=/opt/java1.5/jre/lib/endorsed with java executable and measure CPU utilization.

On my machine (HP-UX Itanium server), With java 1.5 with inbuilt xalan version 2.6.0 gives better perfomance then xalan 2.7.1 version. Xalan 2.7.1 takes approx. 20% more than java 1.5 with inbuilt xalan 2.6.0.


I used the same xml, xsl and schema files in my test. 

Why xalan 2.7.1 takes more cpu than standard java 1.5. inbuild with xalan-2.6.0 version ?

What should I do so that I can get the same performace with xalan-2.7.1 as I am getting with Standard java 1.5 ?


Thanks & regards
Ajay B.



      

Re: xalan 2.7.1 performance issues

Posted by Michael Ludwig <ml...@as-guides.com>.
ajay bhadauria schrieb:
> Finally, I figured performance issues. I have used the following property
>
> Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl

You're aware you keep posting the typo Henry pointed out, aren't you?

Michael

Re: xalan 2.7.1 performance issues

Posted by ajay bhadauria <ab...@yahoo.com>.
Henry,

Thanks for help.

Finally, I figured performance issues. I have used the following property

Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl

and I used the DOMResult for result tree for transformation. It gives better performance than standard java1.5 with inbuilt xalan 2.6.0.

Thanks a lot for help.

Ajay  

--- On Mon, 11/3/08, ajay bhadauria <ab...@yahoo.com> wrote:

> From: ajay bhadauria <ab...@yahoo.com>
> Subject: Re: xalan 2.7.1 performance issues
> To: "Henry Zongaro" <zo...@ca.ibm.com>
> Cc: "Michael Ludwig" <ml...@as-guides.com>, xalan-j-users@xml.apache.org
> Date: Monday, November 3, 2008, 9:04 PM
> Hi Henry,
> 
> You are right. I was still wrong using properties. Thanks
> for correction. But still I am not able to understand that
> how to use xsltc (xsl compiler ).
> 
> I am setting properties as you mentioned like below
> 
> Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl
> 
> Do I also need to set the following in my code before 
> creating transformer factory ? 
> 
>     String key =
> "javax.xml.transform.TransformerFactory";
>     String value =
> "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
>     Properties props = System.getProperties();
>     props.put(key, value);
>     System.setProperties(props);
> 
> Thanks a lot
> 
> Ajay 
> 
> --- On Mon, 11/3/08, Henry Zongaro
> <zo...@ca.ibm.com> wrote:
> 
> > From: Henry Zongaro <zo...@ca.ibm.com>
> > Subject: Re: xalan 2.7.1 performance issues
> > To: abhadauria@yahoo.com
> > Cc: "Michael Ludwig"
> <ml...@as-guides.com>, xalan-j-users@xml.apache.org
> > Date: Monday, November 3, 2008, 7:59 PM
> > Hi, Ajay.
> > 
> > ajay bhadauria <ab...@yahoo.com> wrote on
> > 2008-11-03 08:50:12 AM:
> > >  Michael,
> > > 
> > > Thanks for quick response,
> > > 
> > > Yes, this is a typo. I am using correct property
> as
> > you mentioned.
> > > 
> > >
> >
> -Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc...
> > 
> > I'm not sure whether that's another typo in
> your
> > e-mail or in the way you 
> > invoke your application as well.  You wrote:
> > 
> >
> -Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl
> > 
> > but that should be
> > 
> >
> -Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl
> >                                ^^
> > 
> > A tip:  the easiest way to tell whether you've got
> the
> > TransformerFactory 
> > property right is to supply garbage as it's value.
>  So,
> > 
> >
> -Djavax.xml.transform.TransformerFactory=blah.blah.BlahBlahBlah
> > 
> > If you don't get errors complaining that the
> specified
> > class wasn't found, 
> > it means you've typed the system property name
> > incorrectly.
> > 
> > Thanks,
> > 
> > Henry
> >
> ------------------------------------------------------------------
> > Henry Zongaro
> > XML Transformation & Query Development
> > IBM Toronto Lab   T/L 313-6044;  Phone +1 905 413-6044
> > mailto:zongaro@ca.ibm.com


      

Re: xalan 2.7.1 performance issues

Posted by ajay bhadauria <ab...@yahoo.com>.
Hi Henry,

You are right. I was still wrong using properties. Thanks for correction. But still I am not able to understand that how to use xsltc (xsl compiler ).

I am setting properties as you mentioned like below

Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl

Do I also need to set the following in my code before  creating transformer factory ? 

    String key = "javax.xml.transform.TransformerFactory";
    String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
    Properties props = System.getProperties();
    props.put(key, value);
    System.setProperties(props);

Thanks a lot

Ajay 

--- On Mon, 11/3/08, Henry Zongaro <zo...@ca.ibm.com> wrote:

> From: Henry Zongaro <zo...@ca.ibm.com>
> Subject: Re: xalan 2.7.1 performance issues
> To: abhadauria@yahoo.com
> Cc: "Michael Ludwig" <ml...@as-guides.com>, xalan-j-users@xml.apache.org
> Date: Monday, November 3, 2008, 7:59 PM
> Hi, Ajay.
> 
> ajay bhadauria <ab...@yahoo.com> wrote on
> 2008-11-03 08:50:12 AM:
> >  Michael,
> > 
> > Thanks for quick response,
> > 
> > Yes, this is a typo. I am using correct property as
> you mentioned.
> > 
> >
> -Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc...
> 
> I'm not sure whether that's another typo in your
> e-mail or in the way you 
> invoke your application as well.  You wrote:
> 
> -Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl
> 
> but that should be
> 
> -Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl
>                                ^^
> 
> A tip:  the easiest way to tell whether you've got the
> TransformerFactory 
> property right is to supply garbage as it's value.  So,
> 
> -Djavax.xml.transform.TransformerFactory=blah.blah.BlahBlahBlah
> 
> If you don't get errors complaining that the specified
> class wasn't found, 
> it means you've typed the system property name
> incorrectly.
> 
> Thanks,
> 
> Henry
> ------------------------------------------------------------------
> Henry Zongaro
> XML Transformation & Query Development
> IBM Toronto Lab   T/L 313-6044;  Phone +1 905 413-6044
> mailto:zongaro@ca.ibm.com


      

Re: xalan 2.7.1 performance issues

Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hi, Ajay.

ajay bhadauria <ab...@yahoo.com> wrote on 2008-11-03 08:50:12 AM:
>  Michael,
> 
> Thanks for quick response,
> 
> Yes, this is a typo. I am using correct property as you mentioned.
> 
> -Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc...

I'm not sure whether that's another typo in your e-mail or in the way you 
invoke your application as well.  You wrote:

-Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl

but that should be

-Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl
                               ^^

A tip:  the easiest way to tell whether you've got the TransformerFactory 
property right is to supply garbage as it's value.  So,

-Djavax.xml.transform.TransformerFactory=blah.blah.BlahBlahBlah

If you don't get errors complaining that the specified class wasn't found, 
it means you've typed the system property name incorrectly.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Toronto Lab   T/L 313-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com


Re: xalan 2.7.1 performance issues

Posted by ajay bhadauria <ab...@yahoo.com>.
 Michael,

Thanks for quick response,

Yes, this is a typo. I am using correct property as you mentioned.

-Djavax.xml.transform.TransformFactory=org.apache.xalan.xsltc...

Thanks & regards
Ajay 


--- On Mon, 11/3/08, Michael Ludwig <ml...@as-guides.com> wrote:

> From: Michael Ludwig <ml...@as-guides.com>
> Subject: Re: xalan 2.7.1 performance issues
> To: xalan-j-users@xml.apache.org
> Date: Monday, November 3, 2008, 7:06 PM
> ajay bhadauria schrieb:
> 
> >
> Djavax.xml.transformoFactory=org.apache.xalan.xsltc.trax.[...]
>                 ------^------
> Not sure this helps solve your problem, but there is a typo
> here.
> It should read:
> "-Djavax.xml.transform.TransformerFactory=...".
> 
> Michael Ludwig


      

Re: xalan 2.7.1 performance issues

Posted by Michael Ludwig <ml...@as-guides.com>.
ajay bhadauria schrieb:

> Djavax.xml.transformoFactory=org.apache.xalan.xsltc.trax.[...]
                 ------^------
Not sure this helps solve your problem, but there is a typo here.
It should read: "-Djavax.xml.transform.TransformerFactory=...".

Michael Ludwig

Re: xalan 2.7.1 performance issues

Posted by ajay bhadauria <ab...@yahoo.com>.
Michael,

Thanks for explanation.

You are right. I was comparing the cpu utilization time of my tests between Java1.5 and xalan-2.7.1. I did not know the fact that that standard Java 1.5 uses xslt compjailer instead of interpreter. 

In order to use, xalan 2.7.1 xslt compiler, what should I exactly do ?

I am doing following 

- copied all the xalan 2.7.1 in the endorsed directory under lib .
- use -Djava.endorsed.dir=/opt/java1.5/jre/lib/endorsed
-
Djavax.xml.transformoFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl

But it does not help in better CPU utilization. Is there any other way I should set system properties ?

Thanks
Ajay  

--- On Sat, 11/1/08, Michael Glavassevich <mr...@ca.ibm.com> wrote:

> From: Michael Glavassevich <mr...@ca.ibm.com>
> Subject: Re: xalan 2.7.1 performance issues
> To: xalan-j-users@xml.apache.org
> Cc: abhadauria@yahoo.com
> Date: Saturday, November 1, 2008, 9:57 AM
> Xalan has two XSLT processors: an interpreter and a compiler
> called XSLTC.
> The default processor is the interpreter. I believe XSLTC
> produces much
> faster runtime code. Sun only ships XSLTC [1] so that is
> what you get by
> default from Sun Java 5. Wouldn't be surprised if the
> comparison was
> Xalan-J 2.7.1 interpreter vs. Java 5 XSLTC. If that's
> what was done try
> switching to Xalan-J 2.7.1 XSLTC.
> 
> Thanks.
> 
> [1] http://java.sun.com/j2se/1.5.0
> /docs/guide/xml/jaxp/ReleaseNotes_150.html#xsltc
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> "Mukul Gandhi" <ga...@gmail.com>
> wrote on 11/01/2008 12:10:39 AM:
> 
> > On Sat, Nov 1, 2008 at 2:20 AM, ajay bhadauria
> <ab...@yahoo.com>
> wrote:
> > > Why xalan 2.7.1 takes more cpu than standard java
> 1.5. inbuild
> > with xalan-2.6.0 version ?
> >
> > I don't generally consider CPU utilization as a
> measure of performance
> > (it's an important aspect, though). It's
> normally beyond programmer's
> > control. I usually try to optimize memory usage, and
> run time. It
> > would be nice, if you can share the run time
> comparison.
> >
> > > What should I do so that I can get the same
> performace with
> > xalan-2.7.1 as I am getting with Standard java 1.5 ?
> >
> > First please share the performance numbers of Xalan-J
> 2.7.1 vs. JDK
> > Xalan. The performance data could vary from one
> XML/XSL to another.
> >
> > Also, is using Xalan-J 2.7.1 important to you, or the
> performance? Is
> > performance affecting you very badly? Xalan-J 2.7.1
> has lot of
> > improvements (bug fixes, etc.) as compared to the
> Xalan bundled with
> > JDK.
> >
> >
> > --
> > Regards,
> > Mukul Gandhi


      

Re: xalan 2.7.1 performance issues

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Xalan has two XSLT processors: an interpreter and a compiler called XSLTC.
The default processor is the interpreter. I believe XSLTC produces much
faster runtime code. Sun only ships XSLTC [1] so that is what you get by
default from Sun Java 5. Wouldn't be surprised if the comparison was
Xalan-J 2.7.1 interpreter vs. Java 5 XSLTC. If that's what was done try
switching to Xalan-J 2.7.1 XSLTC.

Thanks.

[1] http://java.sun.com/j2se/1.5.0
/docs/guide/xml/jaxp/ReleaseNotes_150.html#xsltc

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Mukul Gandhi" <ga...@gmail.com> wrote on 11/01/2008 12:10:39 AM:

> On Sat, Nov 1, 2008 at 2:20 AM, ajay bhadauria <ab...@yahoo.com>
wrote:
> > Why xalan 2.7.1 takes more cpu than standard java 1.5. inbuild
> with xalan-2.6.0 version ?
>
> I don't generally consider CPU utilization as a measure of performance
> (it's an important aspect, though). It's normally beyond programmer's
> control. I usually try to optimize memory usage, and run time. It
> would be nice, if you can share the run time comparison.
>
> > What should I do so that I can get the same performace with
> xalan-2.7.1 as I am getting with Standard java 1.5 ?
>
> First please share the performance numbers of Xalan-J 2.7.1 vs. JDK
> Xalan. The performance data could vary from one XML/XSL to another.
>
> Also, is using Xalan-J 2.7.1 important to you, or the performance? Is
> performance affecting you very badly? Xalan-J 2.7.1 has lot of
> improvements (bug fixes, etc.) as compared to the Xalan bundled with
> JDK.
>
>
> --
> Regards,
> Mukul Gandhi

Re: xalan 2.7.1 performance issues

Posted by ajay bhadauria <ab...@yahoo.com>.
Hi Mukul,

Thanks for response.

I was doing performance test on java 1.5 and collected some data. I also did the same test using xalan java 2.7.1. So, I got some 20 % more CPU utilization for exactly same kind of test. I was using same xml document size, schema size, and xsl size file. 

Since performance is very important for my application so I cache all the schemas and xsl files in the memory. Therefore, I was wondering why xalan 2.7.1 takes more cpu than standard java 1.5 which comes with xalan 2.6.0. 

I did not know the fact that xalan 2.7.1 comes with compiler and interpreter and by default it uses interpreter to transform xml.

I will post all the performance data after completeing the test.


Thanks & Regards
Ajay  

--- On Sat, 11/1/08, Mukul Gandhi <ga...@gmail.com> wrote:

> From: Mukul Gandhi <ga...@gmail.com>
> Subject: Re: xalan 2.7.1 performance issues
> To: abhadauria@yahoo.com
> Cc: xalan-j-users@xml.apache.org
> Date: Saturday, November 1, 2008, 9:40 AM
> On Sat, Nov 1, 2008 at 2:20 AM, ajay bhadauria
> <ab...@yahoo.com> wrote:
> > Why xalan 2.7.1 takes more cpu than standard java 1.5.
> inbuild with xalan-2.6.0 version ?
> 
> I don't generally consider CPU utilization as a measure
> of performance
> (it's an important aspect, though). It's normally
> beyond programmer's
> control. I usually try to optimize memory usage, and run
> time. It
> would be nice, if you can share the run time comparison.
> 
> > What should I do so that I can get the same performace
> with xalan-2.7.1 as I am getting with Standard java 1.5 ?
> 
> First please share the performance numbers of Xalan-J 2.7.1
> vs. JDK
> Xalan. The performance data could vary from one XML/XSL to
> another.
> 
> Also, is using Xalan-J 2.7.1 important to you, or the
> performance? Is
> performance affecting you very badly? Xalan-J 2.7.1 has lot
> of
> improvements (bug fixes, etc.) as compared to the Xalan
> bundled with
> JDK.
> 
> 
> -- 
> Regards,
> Mukul Gandhi


      

Re: xalan 2.7.1 performance issues

Posted by Mukul Gandhi <ga...@gmail.com>.
On Sat, Nov 1, 2008 at 2:20 AM, ajay bhadauria <ab...@yahoo.com> wrote:
> Why xalan 2.7.1 takes more cpu than standard java 1.5. inbuild with xalan-2.6.0 version ?

I don't generally consider CPU utilization as a measure of performance
(it's an important aspect, though). It's normally beyond programmer's
control. I usually try to optimize memory usage, and run time. It
would be nice, if you can share the run time comparison.

> What should I do so that I can get the same performace with xalan-2.7.1 as I am getting with Standard java 1.5 ?

First please share the performance numbers of Xalan-J 2.7.1 vs. JDK
Xalan. The performance data could vary from one XML/XSL to another.

Also, is using Xalan-J 2.7.1 important to you, or the performance? Is
performance affecting you very badly? Xalan-J 2.7.1 has lot of
improvements (bug fixes, etc.) as compared to the Xalan bundled with
JDK.


-- 
Regards,
Mukul Gandhi