Jump to content
We've recently updated our Privacy Statement, available here ×

Large Report :: Virtualizer a solution?


yaramada123

Recommended Posts

Hi,

We are trying to produce a report with large data (around million rows) and are getting heap space error while trying to generate the report. I found that virtualizer can solve the issue with space by swapping data with disk space, I have used Swap File Virtualizer and still getting the heap space error. I can see that a swap file of around 200 MB is created on my local and then its erroring out.

 

Here is what I would like to know::

1. How does Jasper gets the data, does it get all at a time or paginate through the resultset. If it gets the all data at once where does it store? Could this be causing heap space issue, if so how did it created a swap file of around 200MB?

Here is the code I have used:

JRConcurrentSwapFile jrSwapFile = new JRConcurrentSwapFile("C:/",30,2);

 

JRSwapFileVirtualizer virtualizer = new JRSwapFileVirtualizer(2,jrSwapFile,true);

 

data1.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);

 

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, data1, jdbcConnection);

 

2. Can I use JasperServer for running reports, I don't want to use other features like UI, scheduling etc., All I want to do is use JasperServer's JVM to run Reports as there could be memory optimization and virtualization implemented in a betterway.

 

Any pointers to how to solve the issue of genereating large report without heap space error is greatly appreciated. Thanks in advance!!!

 

Jagadeesh

Link to comment
Share on other sites

  • Replies 15
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

Virtualization deals with the size of the generated document, not with in-coming data.

 

If you use a JDBC data source, then it is the responsibility of the JDBC driver to fetch data in small chunks and not all at one. JasperReports does not load it all, but ask for rows one by one, and does not keep them.

 

Can you give more details about what kind of document it is? Does it contain many different images?

 

Thanks,

Teodor

Link to comment
Share on other sites

It doesn't contain any images, my report pulls about 30 columns for a specified date range...SQL is returning more than 300K rows....When I try to run the report a swap file is getting created but after the swap file size reaches 200MB its blowing with Out of memory : heap space error message....

 

Looking at the concept of virtualizer, this should work fine as I am not doing anything fancy.....SQL is embedded with in the template, as jasper does not get data at once this should not create any problems...Is there a minimum requirement of heap space for virtualizer to function properly??

 

Here is the code I have used for virtualizer:

JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

 

JRConcurrentSwapFile jrSwapFile = new JRConcurrentSwapFile("C:/Temp",30,4);

 

JRSwapFileVirtualizer virtualizer = new JRSwapFileVirtualizer(4,jrSwapFile,true);

 

data1.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);

 

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, data1, jdbcConnection);

 

JRVirtualizationContext.getRegistered(jasperPrint).setReadOnly(true);

 

JasperExportManager.exportReportToPdfFile(jasperPrint, "reports/TRExpenseLog.pdf");

Link to comment
Share on other sites

I just tried the exact same report with FileVirtualizer and it ran with out any errors....17095 temp files were created which is equal to the number of pages in the report. I wonder why SwapFileVirtualizer is not working, I would like to get it working as it uses single swap file as opposed to FileVirtualizer....I can get into performance issues with FileVirtualizer due to large number of I/O operations.....please help me in getting SwapFileVirtualizer working....

 

Thanks and Regards,

Jagadeesh

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 months later...

Hi,

 

Even I have a similar kind of problem.

I have subreports inside subreports. And, the specifications demanded the results in such a way that I had to use joins in almost each of the subreports. The report displays large data as well.

 

Can you please let me know how did you get the JDBC get the data in chunks and also how did you get the FileVirtualizer work for you?

 

I use FileVirtualizer, but it won't work.

 

Thanks in advance.

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

Hi,

I would start a new thread and not continue one from 07' since that was a long time ago and many jasper versions ago :-)

If you're having memory problems, I would make a new thread and try to attach your code and any condensed down .jrxml files to that thread to increase your odds of someone helping.

Link to comment
Share on other sites

 I can not find any documentation on this on any site.   Can anyone point me in the right direction? 

Code:
 if (VITUALIZER_SWAP_FILE.equals(virtualizerType)){				// creating the virtualizer				JRSwapFile swapFile = new JRSwapFile(cacheDir, 2048, 1024);				//JRSwapFile swapFile = new JRSwapFile( getServletContext().getRealPath("/reports/operationalreports/"), 1024, 1024);								JRSwapFileVirtualizer virtualizer = new JRSwapFileVirtualizer(3, swapFile, true);				parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);				}long start = System.currentTimeMillis();		    JasperPrint  jasperPrint = JasperFillManager.fillReport(testReport,parameters,dataSource);		    long end=System.currentTimeMillis();		    System.out.println("Filling time : " + ((end - start)/1000));
Link to comment
Share on other sites

Sure, I can try to help and I'm sure others want to as well.  First, create a new thread and get off of this one.  Second, give us as many details in as a verbose but consice manner as possible within the new thread.  Just saying, "help I have a memory problem" is not going to get you much help.  How could we?

For details (on the new thread), give us things such as stack traces, what version of Jasper you're using, any .jrxml files that you're using, export formats that you're exporting against, and then some idea of how much data you're trying to export.  Any possible way to get us an actual running example of Jasper running out of memory is always the golden trophy.

Link to comment
Share on other sites

I started a new topic not very many days ago related to this same thing, and have had some views, but no responses.  Any help would be appreciated..  I have tried using Jasper versions 3.7.0, 4.1.2, and the most recently released 4.1.3 and am still receiving an OutOfMemory exception when PDF 508 tags are turned on.  When they are off the report completes successfully.

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...