Memory Management with JasperReports Server
This article contains information to assist in managing memory utilization in JasperReports Server.
Standard Advice for J2EE Applications
One of the primary issues with memory management is simply not sizing your memory allocation appropriately for your implementation. Any J2EE application/application server that:
- processes large data sets
- generates large reports
- has many concurrent users and/or scheduled reports
- contains multiple applications running
may require a significant amount of memory to operate efficiently. JasperReports Server and JasperReports Library rely on the JVM heap as well as the PermGen memory. The allocation of memory to these areas are set as JVM parameters when your application server is started. In addition, it is important to take into account the JVM garbage collection settings when tuning your application for memory utilization and performance considerations.
JasperReports Server and JasperReports Library Specific Advice
JasperReports uses report virtualizers to address many memory consumption issues associated with large reports. These virtualizers leverage memory compression or file based virtualization to reduce the memory consumed by large reports.
Where virtualizers may not help
The main consumers of memory that are not virtualized and can cause out of memory issues are:
- Ad Hoc editing
- Running Ad Hoc based reports
- Jaspersoft OLAP
Jaspersoft OLAP caches data across users, so it is pretty efficient. However, Jaspersoft OLAP can cause problems with large datasets. Jaspersoft OLAP does have a memory monitor that catches out-of-memory exceptions to stop the server being killed, but this can lead to results being cut off.
Ad Hoc Reports and Editing
Ad Hoc stores query results in memory when editing an Ad Hoc report, or running a report created via Ad Hoc Editor. Quite a bit of refinement has been made around Ad Hoc editing and reporting to address memory consumption (compression, tuning of how much memory a report takes), but there are always limits. There are configurable limits now in place on the number of records returned by default during the Ad Hoc report design phase. In addition, the Ad Hoc cache can be tuned through various configuration settings to balance performance and memory utilization.