You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Yatin Soni <ya...@interinfosystems.com> on 2007/08/31 19:00:26 UTC

Performance issue with FOP

Hi,

    I am using FOP for the PDF generation in our project and For creating the xml source I am using the DOMSource model.Now at the 
time of transforming the XML document into PDF CPU usage rises to 99% and not getting down. Every time I am generating PDF I am 
facing same problem and this causes low performance at Server side. Please help me out resolving this issue. How I can reduce the CPU
usage?

Following code is used for the FOP:

    OutputStream out = new FileOutputStream(tempFile);
    out = new BufferedOutputStream(out);
    FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
    Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    Source source = new DOMSource(document);
    Result result = new SAXResult(fop.getDefaultHandler());
    transformer.transform(source, result);

I am new to FOP so please help me resolving this issue... 

Thanks,
Yatin Soni

Re: Performance issue with FOP

Posted by Yatin Soni <ya...@interinfosystems.com>.
hi,

When I am running FOP from the command line it is running pretty good and
provides PDF and also when FOP is running from the tomcat
it provides PDF but problem is that once the FOP generates the pdf after
that it is taking CPU resources and CPU rises at 99 and stayed their
so I need to restart the tomcat...
Each and every time i run FOP in the Tomcat it goes high.. in Task manager
it shows Java.exe taking 99% resources of CPU and after that I need to
resatart the Tomcat...

Thanks,
Yatin Soni

----- Original Message -----
From: "Manuel Mall" <ma...@apache.org>
To: <fo...@xmlgraphics.apache.org>
Sent: 21, 09, 2007 3:58 PM
Subject: Re: Performance issue with FOP


> On Friday 21 September 2007 18:13, Yatin Soni wrote:
> > Hi,
> >
> > How  can I make JVM to use Xerces and Xalan that are distributed with
> > FOP are used ?
> >
> > I have provided following optional argument
> > -Dorg.apache.commons.logging.simplelog.defaultlog=WARN/ERROR
> > -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.T
> >ransfor merFactoryImpl
> >
> > but still results are same CPU rises to 99% and remain 99 until I
> > restart the tomcat....
> >
> > I had tried with this approach where I had provided XSL and XML
> > seperately but still I am facing
> > same issue.....
>
> It is unclear to me which steps you have and have not done to isolate
> the problem.
>
> If you run FOP from the command line using the same XML and XSL as
> inputs does it work or not?
>
> Have you tried using jconsole (assuming you are using a 1.5 JVM or
> later) and looked at the thread stack traces to identify were it loops?
>
> Have you tried using your Java development IDE and a debugger to verify
> that the methods you call to obtain the XML and XSL input sources
> return the correct results?
>
> Manuel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Performance issue with FOP

Posted by Manuel Mall <ma...@apache.org>.
On Friday 21 September 2007 18:13, Yatin Soni wrote:
> Hi,
>
> How  can I make JVM to use Xerces and Xalan that are distributed with
> FOP are used ?
>
> I have provided following optional argument
> -Dorg.apache.commons.logging.simplelog.defaultlog=WARN/ERROR
> -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.T
>ransfor merFactoryImpl
>
> but still results are same CPU rises to 99% and remain 99 until I
> restart the tomcat....
>
> I had tried with this approach where I had provided XSL and XML
> seperately but still I am facing
> same issue.....

It is unclear to me which steps you have and have not done to isolate 
the problem.

If you run FOP from the command line using the same XML and XSL as 
inputs does it work or not?

Have you tried using jconsole (assuming you are using a 1.5 JVM or 
later) and looked at the thread stack traces to identify were it loops?

Have you tried using your Java development IDE and a debugger to verify 
that the methods you call to obtain the XML and XSL input sources 
return the correct results?

Manuel

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Performance issue with FOP

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 21, 2007, at 12:13, Yatin Soni wrote:

> How  can I make JVM to use Xerces and Xalan that are distributed  
> with FOP
> are used ?
>
> I have provided following optional argument
> -Dorg.apache.commons.logging.simplelog.defaultlog=WARN/ERROR
> - 
> Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.Tra 
> nsfor
> merFactoryImpl

Setting the JAXP sysprop is not enough if the bootstrapped XSLT  
processor is simply a different version of Xalan than the one that is  
shipped with FOP, IIC. Might work if you try Saxon instead.
Java provides the 'endorsed standards' mechanism to override the  
bootstrapped Xalan. Try copying the Xalan JAR that is shipped with  
FOP to the $JAVA_HOME$/lib/endorsed folder (create if it does not  
exist), then restart the server.


Cheers

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Performance issue with FOP

Posted by Yatin Soni <ya...@interinfosystems.com>.
Hi,

How  can I make JVM to use Xerces and Xalan that are distributed with FOP
are used ?

I have provided following optional argument
-Dorg.apache.commons.logging.simplelog.defaultlog=WARN/ERROR
-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.Transfor
merFactoryImpl

but still results are same CPU rises to 99% and remain 99 until I restart
the tomcat....

I had tried with this approach where I had provided XSL and XML seperately
but still I am facing
same issue.....
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////
 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
  // Setup XSLT
 TransformerFactory factory = TransformerFactory.newInstance();
 Transformer transformer = factory.newTransformer(new StreamSource(xslt));
 // Setup input for XSLT transformation
 Source src = team.getSourceForProjectTeam();
// Resulting SAX events (the generated FO) must be piped through to FOP
Result res = new SAXResult(fop.getDefaultHandler());
// Start XSLT transformation and FOP processing
transformer.transform(src, res);
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////
Here i am using the default example given with the FO-93 source
distribution...
is the other implementations are available to getDefaultHandler ?

Thanks,
Yatin

----- Original Message -----
From: "Andreas L Delmelle" <a_...@pandora.be>
To: <fo...@xmlgraphics.apache.org>
Sent: 15, 09, 2007 5:45 PM
Subject: Re: Performance issue with FOP


> On Sep 12, 2007, at 18:35, Yatin Soni wrote:
>
> Hello
>
> > ----- Original Message -----
> > From: "J.Pietschmann" <j3...@yahoo.de>
> > To: <fo...@xmlgraphics.apache.org>
> > Sent: 04, 09, 2007 12:49 AM
> > Subject: Re: Performance issue with FOP
> >
> >
> >> Yatin Soni wrote:
> >>> Now at the time of
> >>> transforming the XML document into PDF CPU usage rises to 99% and
> >>> not
> >>> getting down. Every time I am generating PDF I am facing same
> >>> problem
> >>> and this causes low performance at Server side. Please help me out
> >>> resolving this issue. How I can reduce the CPU usage?
> >>>
> >> [snip]
> >> First: which FOP release are you using? What Java version are you
> >> using? Whats the general environment?
> >>
> >> You should try to isolate the problem. Get the source XML written
> >> into a file and use the FOP command line to produce a PDF. Is the
> >> CPU load still high? Then run the XSLT separately, and run the
> >> resulting FO through the FOP command line again. This should give
> >> you an idea whether the problem is in the XSLT or with FOP. In the
> >> latter case, run it again giving the JVM more memory. If there's
> >> still a problem with FOP, post it again.
>
> > Thanks for reply.
> >
> > I am using FOP 0.93 build and java version i am using is JDK1.6 and
> > using
> > Windows 2000 as operating system...
>
> In your original post, you indicate that you are using a DOMSource,
> so my questions would be:
> * Have you tried SAX instead?
> * Did you try out different XML parsers (= different DOM
> implementations) than the one bundled with your JVM? (Note that the
> versions of Xerces and Xalan that are distributed with FOP are used
> only if your JVM does not bootstrap other versions or different
> vendors...)
>
>
> HTH!
>
> Cheers
>
> Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Performance issue with FOP

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 12, 2007, at 18:35, Yatin Soni wrote:

Hello

> ----- Original Message -----
> From: "J.Pietschmann" <j3...@yahoo.de>
> To: <fo...@xmlgraphics.apache.org>
> Sent: 04, 09, 2007 12:49 AM
> Subject: Re: Performance issue with FOP
>
>
>> Yatin Soni wrote:
>>> Now at the time of
>>> transforming the XML document into PDF CPU usage rises to 99% and  
>>> not
>>> getting down. Every time I am generating PDF I am facing same  
>>> problem
>>> and this causes low performance at Server side. Please help me out
>>> resolving this issue. How I can reduce the CPU usage?
>>>
>> [snip]
>> First: which FOP release are you using? What Java version are you
>> using? Whats the general environment?
>>
>> You should try to isolate the problem. Get the source XML written
>> into a file and use the FOP command line to produce a PDF. Is the
>> CPU load still high? Then run the XSLT separately, and run the
>> resulting FO through the FOP command line again. This should give
>> you an idea whether the problem is in the XSLT or with FOP. In the
>> latter case, run it again giving the JVM more memory. If there's
>> still a problem with FOP, post it again.

> Thanks for reply.
>
> I am using FOP 0.93 build and java version i am using is JDK1.6 and  
> using
> Windows 2000 as operating system...

In your original post, you indicate that you are using a DOMSource,  
so my questions would be:
* Have you tried SAX instead?
* Did you try out different XML parsers (= different DOM  
implementations) than the one bundled with your JVM? (Note that the  
versions of Xerces and Xalan that are distributed with FOP are used  
only if your JVM does not bootstrap other versions or different  
vendors...)


HTH!

Cheers

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Performance issue with FOP

Posted by Yatin Soni <ya...@interinfosystems.com>.
Hi J.Pietschmann,

Thanks for reply.

I am using FOP 0.93 build and java version i am using is JDK1.6 and using
Windows 2000 as operating system...

When I am trying from command line at that time also CPU raises to 99% and
not getting down and as soon as the java program exits it goes to normal...

and same thing is happening with the code running in Tomcat container and
javaw.exe goes to 99% as I any request is come for the PDF to generate and
never comes down until the tomcat gets restart...

Why tomcat raises to 99% while the PDF generation proccess running and after
the comletion of the fop transformation it never comes down until it never
comes down?

Thanks,
Yatin

----- Original Message -----
From: "J.Pietschmann" <j3...@yahoo.de>
To: <fo...@xmlgraphics.apache.org>
Sent: 04, 09, 2007 12:49 AM
Subject: Re: Performance issue with FOP


> Yatin Soni wrote:
> > Now at the time of
> > transforming the XML document into PDF CPU usage rises to 99% and not
> > getting down. Every time I am generating PDF I am facing same problem
> > and this causes low performance at Server side. Please help me out
> > resolving this issue. How I can reduce the CPU usage?
> >
> [snip]
> First: which FOP release are you using? What Java version are you
> using? Whats the general environment?
>
> You should try to isolate the problem. Get the source XML written
> into a file and use the FOP command line to produce a PDF. Is the
> CPU load still high? Then run the XSLT separately, and run the
> resulting FO through the FOP command line again. This should give
> you an idea whether the problem is in the XSLT or with FOP. In the
> latter case, run it again giving the JVM more memory. If there's
> still a problem with FOP, post it again.
>
> J.Pietschmann
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Performance issue with FOP

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Yatin Soni wrote:
> Now at the time of
> transforming the XML document into PDF CPU usage rises to 99% and not
> getting down. Every time I am generating PDF I am facing same problem
> and this causes low performance at Server side. Please help me out
> resolving this issue. How I can reduce the CPU usage?
> 
[snip]
First: which FOP release are you using? What Java version are you
using? Whats the general environment?

You should try to isolate the problem. Get the source XML written
into a file and use the FOP command line to produce a PDF. Is the
CPU load still high? Then run the XSLT separately, and run the
resulting FO through the FOP command line again. This should give
you an idea whether the problem is in the XSLT or with FOP. In the
latter case, run it again giving the JVM more memory. If there's
still a problem with FOP, post it again.

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org