Generating Huge Reports

1

Hi All,

I have deployed my report server on JBOSS EAP 6.2. I used xml datasource as my data file and genarate xls. My datafile contains 25MB of data. When I call the web service of my report server it tooks more than 4 hours to genarate the xls report. This report has 5660 rows only. When I debug the code the program is wating at the fill report method.

JasperPrint _print = JasperFillManager.fillReport(jasperReport,  reportParams, datasource);

I have incread the JVM memory in JBOSS, but still I'm facing the problem. Also I have used virtualizer. But didn't solve the problem. 

Could any one point some clue for me to slove the above problem. Below I have put the genarate xls method which I'm using.

public InputStream xlsReportGen(String xml, String reportTemplate, String reportPath, Map<String,Object> reportParams) throws Exception {
 
ByteArrayOutputStream _out = new ByteArrayOutputStream();
JRDataSource datasource = new JRXmlDataSource(new File(xml));
JasperReport jasperReport = (JasperReport)JRLoader.loadObjectFromFile(reportPath + reportTemplate);
 
// creating the virtualizer
JRSwapFile swapFile = new JRSwapFile(reportPath, 4096, 4096);
JRAbstractLRUVirtualizer virtualizer = new JRSwapFileVirtualizer(5000, swapFile, true);
reportParams.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);
 
JasperPrint _print = JasperFillManager.fillReport(jasperReport,  reportParams, datasource);
 
if (virtualizer != null)
{
virtualizer.cleanup();
}
 
JRXlsExporter exporter = new JRXlsExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, _print);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, _out);
exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);
exporter.exportReport();
 
return new ByteArrayInputStream(_out.toByteArray());
}

Thanks !

Manula Thantriwatte

 

 

 

manulachathurika's picture
Joined: Aug 12 2015 - 9:16pm
Last seen: 3 years 7 months ago

6 Answers:

1

If you only have 25MB of data, do you really need to use virtualizer? You're also using xml as your datasource - xml are very slow. I've found csv datasource to be faster.

http://community.jaspersoft.com/questions/913731/time-process-500000-row...

hozawa's picture
53142
Joined: Apr 24 2010 - 4:31pm
Last seen: 5 months 1 week ago
0

Hi Hozawa,

Thanks for your point. In the movement I'm unable to changed the datasource. Because our system is tied with XML. I used virtualizer because that 25MB XML filed tooks more than 4 hours to process and generate the xls report. When I used that XML in iReport and able to generate the xls. But in that case I have to increase the Java heap memory. 

Is there any other way to achieve this ?

Thanks !

Manula Thantriwatte

 

manulachathurika's picture
Joined: Aug 12 2015 - 9:16pm
Last seen: 3 years 7 months ago
1

Did you check which line in your code is taking the most time? Also, monitor memory and CPU usage of your web server. It's better to increase jvm memory of your application server instead of using virtualizer.

hozawa's picture
53142
Joined: Apr 24 2010 - 4:31pm
Last seen: 5 months 1 week ago
0

Hi Hozawa,

JasperPrint _print = JasperFillManager.fillReport(jasperReport,  reportParams, datasource) code line taking the most of the time. Without the virtualizer alsot above line tooks the time. I have incread the JVM memory as well. But still have the problem.

Thanks !

 

manulachathurika's picture
Joined: Aug 12 2015 - 9:16pm
Last seen: 3 years 7 months ago
0

It seems to be the xml datasource. I've tested performance on different datasources and found some to be slower.

Have you tried converting xml to another format in your code and using that as a datasource?

 

hozawa's picture
53142
Joined: Apr 24 2010 - 4:31pm
Last seen: 5 months 1 week ago
0

Now I'm trying to do it with JSON data source. I'll try and let you know the update.

manulachathurika's picture
Joined: Aug 12 2015 - 9:16pm
Last seen: 3 years 7 months ago
Feedback