xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Delmelle <andreas.delme...@telenet.be>
Subject Re: Unnecessary overhead when running Apache FOP via command line
Date Wed, 06 Jan 2010 20:10:10 GMT
On 06 Jan 2010, at 20:23, Gregory Buchenberger wrote:

Hi Ville, Gregory,

> Adding more memory to the Java virtual machine seems to help. run the
> java command with something like:

While this may help a bit, it doesn't eliminate the bulk of the processing time. At the very
best, you could avoid running out of memory by increasing the heap size. The effect on the
processing time is marginal at best. It just causes the garbage collector to run less frequently,
which may shave off half a second if you're lucky.

If you want to avoid JVM warmup, which probably represents about 80% of the mentioned 10 seconds
(if not more), then by far the easiest solution is to familiarize yourself with the servlet
concept.

There is an example servlet that is distributed with FOP, in package org.apache.fop.servlet.

Deploy this in an Apache Tomcat container, and start up Tomcat. If all goes well, you can
then send simple HTTP requests to the port that Tomcat is running on to convert your XML to
PDF.

Note that, since the servlet comes as a part of FOP, such a solution requires no real Java
programming. 
I would estimate at most half a day of work to get yourself basically started, even if your
Java knowledge is minimal. Do mind the disclaimer on the FOP website (link below) concerning
the lack of security in that basic servlet. Deploying it into a production environment as-is
is definitely not recommended, so if that is the goal, then eventually you will need to dive
into the Java code, and enhance it to meet the more rigorous requirements for production servers.
If you just need to run it on your own system, for your personal use, there is no need to
modify the servlet.

Obviously, any enhancement that improves this servlet and does not require external libraries
whose license is not compatible with the Apache license, will be warmly welcomed as a donation.
;-)

I think you'll be surprised at how much of those 10 seconds can be avoided, with relatively
little effort.

More info can be found at: http://xmlgraphics.apache.org/fop/trunk/servlets.html
The source code for the servlet can be viewed at: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/servlet/FopServlet.java?revision=732631&view=markup
Apache Tomcat can be downloaded here: http://tomcat.apache.org/download-60.cgi


Hope this helps!


Regards,

Andreas Delmelle
---


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


Mime
View raw message