You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michal Sg <sg...@yahoo.com> on 2004/09/13 15:51:17 UTC

xalan's Transformer performance in Tomcat

Hi,
 
I use Tomcat 4.0.3 on win2k.
I have the following code:
 
-----------------
Transformer transformer = TransformerFactory.newInstance().newTemplates(new StreamSource(xslFileName)).newTransformer();
 
StreamResult strResult = new StreamResult(new FileOutputStream(outHtmlFileName));   strResult.setSystemId(outHtmlFileName);
  
transformer.transform(new StreamSource(inXmlFileName), strResult);
--------------------
 
When I run this code in a standalone Java process (from command line), I get a result in 30 seconds, but when I run this code from a servlet within Tomcat, it takes 6 (!!) minutes to run. The line of code that takes all this time is the last one - transformer.transform...
I use xalan & xerces 2.6.0
 
can anyone please help reduce this time?
 
Thanks,
Michal.
 

		
---------------------------------
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.

Re: xalan's Transformer performance in Tomcat

Posted by Remy Maucherat <re...@gmail.com>.
On Mon, 13 Sep 2004 06:51:17 -0700 (PDT), Michal Sg <sg...@yahoo.com> wrote:
> Hi,
> 
> I use Tomcat 4.0.3 on win2k.
> I have the following code:
> 
> -----------------
> Transformer transformer = TransformerFactory.newInstance().newTemplates(new StreamSource(xslFileName)).newTransformer();
> 
> StreamResult strResult = new StreamResult(new FileOutputStream(outHtmlFileName));   strResult.setSystemId(outHtmlFileName);
> 
> transformer.transform(new StreamSource(inXmlFileName), strResult);
> --------------------
> 
> When I run this code in a standalone Java process (from command line), I get a result in 30 seconds, but when I run this code from a servlet within Tomcat, it takes 6 (!!) minutes to run. The line of code that takes all this time is the last one - transformer.transform...
> I use xalan & xerces 2.6.0
> 
> can anyone please help reduce this time?

There doesn't seem to be any servlet API objects involved in this, as
the transformation occurs from one file to another. So I don't know,
and you should use a profiler.

You should also be careful that inside Tomcat, you may not be using
the same XML parser and XSL transformer that you are using in your
standalone application.

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org