The data snapshot feature was introduced in JasperReports Server release 4.7 to store report data in the server. Data snapshots create a significant change in the user experience:
• Without data snapshots – Whenever users run a report, the server queries the data source and displays the latest data. When the same report is run over and over, the data source is often returning the same data each and every time. This is the behavior of all releases prior to 4.7, and the default behavior of release 4.7.
• With data snapshots – The first time a report runs, it queries the data source and stores a copy of the data with the report in the repository. Users who view the report later see the data from the saved snapshot, not from querying the data source. Reports accessed through web service APIs are also based on the saved snapshot. For large reports or frequently viewed reports, the persisted snapshot provides a significant performance gain and reduces load on your data sources. Every user who has access to the report will see the data from the same snapshot. For users who require it, the report viewer provides a button to manually refresh the data snapshot anytime. In addition, when the scheduler runs a job on a report it always updates the snapshot. Web service APIs may also refresh the data snapshot. Data snapshots are implemented in JasperReports Server 4.7, but must be enabled manually.
Jaspersoft recommends enabling data snapshots at the server level in the following cases:
• If you have a new installation of JasperReports Server 4.7, then enable snapshots to get the full server functionality. In the future, persistent data snapshots may be enabled by default.
• If you are upgrading to release 4.7, first proceed with the upgrade procedure and verify the outcome, as instructed in the JasperReports Server Installation Guide. Then, before enabling data snapshots, notify your users about this new functionality.
The server-level settings allows you to use data snapshots globally, on every report that does not explicitly disable them at the report level. The following property controls the data snapshot functionality:
Data Snapshots Server-Level Configuration |
||
Configuration File |
||
…\WEB-INF\applicationContext-data-snapshots.xml |
||
Property |
Bean |
Description |
When set to true, it allows the JasperReports Server report viewer to save data snapshots in the repository and open them the next time the report is run. By default, this is set to false. Data snapshots are stored in the server’s repository, which must be sized accordingly. If you have a large number of reports, or very large reports, consider the performance of your repository database before enabling snapshots. If your users rely on data that changes frequently or if they expect to see real-time data when opening a report, do not enable this property. |
At the report level, report writers may explicitly enable or disable data snapshots by setting the following property in the report’s JRXML. The report-level property take precedence over the server-level property. The behavior and limitations are the same as for the server-level setting above:
net.sf.jasperreports.data.cache.persistable=true or false
|
This report-level property depends on the snapshot mechanism in JasperReports Server. This property has no effect in other report viewers without such a mechanism, such as the viewer integrated in Jaspersoft iReport. |