Question

I have an AmazonEC2 instance with 4 cpus. I use it for creating PDF reports on it. The maximum number of user requests are 10 to 15 users in an hour. However, the report size is humongous, around 3000 to 5000 pages PDF files. It takes 70 minutes for FOP to render one of these report.

The issue is Java process is only using one cpu while rendering a report. Is there any way such as from configuration, I can force FOP to use more cpus then only 1?

What have I tried so far?

I have remove the logging as suggested on ApacheFOP website, also I am using page sequences in XSLT I am making sure that I have all the style tags are being reused.

Any changes I have done to FOP?

Few page-sequences are huge so that I have to give -xms 2000M to java so it does not go out of memory. Btw, The machine has 16GB RAM.

Was it helpful?

Solution 2

Apache FOP isn't thread-safe, so it can't be used concurrently across multiple threads. Have you thought about looking for a different solution that handles multi-threading better, like JasperReports? Using JasperReports, you can split those thousands of pages into sub-reports that you run to generate the PDFs. By using sub-reports, JasperReports will automatically spawn new threads to generate them. It will require some work in iReports and some learning on your part, but for reports of this size, I highly recommend it.

OTHER TIPS

Take a look at FOP's Intermediate Format. With it, you can concurrently format multiple documents. Later you can concatenate the intermediate format files to produce a single printing stream very quickly. The most costly part is the formatting. Generating the printing stream afterwards is very quick.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top