Unfortunately, a lot of memory is consumed by FOP. Check the difference for yourself. Launch XSLfast, open your layout with a large XML file and check how much memory is used. Then run FOP and take another look at the memory consumption. You can use the following heuristics for the memory usage when creating large PDF-files with FOP: multiply your XSL-FO file size in bytes with 10; that gives you an idea about the memory that FOP needs to render the file. FOP does the rendering process completely in memory and does not care about the memory consumption. Other (commercial) renderers like XEP from RenderX or XSLFormatter from Antennahouse can decrease his multiplier to 2 or 3 depending on the XSL-FO content, especially if you have a lot of images to be printed. However, when you render a large file with eg. 25.000 customers, this is something where you should always expect that a lot of memory is needed. In production environments, if you need to print very large PDF files, especially in a web environment, we recommend to use an architecture with a queue of requests and limited worker threads or processes to generate the PDF files asynchronously. Once the PDF is created, you can send an notification about it or simply indicate the status by showing the queue. You could implement that like this: a) Instead of generating PDF immediately, collect all necessary files into a queue (eg. by copying the contents in an incoming folder) b) With separate threads / processes, check the incoming folder periodically c) If a new request arrived, move the file(s) out of the incoming folder, and do the formatting via FOP d) When FOP finished the request, move the PDF to an output folder, and return to (b).
This message was edited 3 times. Last update was at 04/09/2009 08:05:09
|