To prevent too many requests from being sent to the underlying data source JasperReports Server caches the data used by the AdHoc designer. The Live time and the Idle time of those data can be personalized in the server configurations.
Modify the caching values if your data does not update constantly
Since version 5
The properties previously defined in the dataSetCache bean of applicationContext-datarator.xml now need to be modified in adhoc-ehcache.xml.
Also, note that times are now in seconds rather than minutes. By default, the timeToLiveSeconds is set to 30 minutes and timeToIdleSeconds is set to 90 minutes.
Old name: defaultTimeoutMinutes
New name: timeToLiveSeconds
Old name: defaultUnusedTimeoutMinutes
New name: timeToIdleSeconds
timeToIdleSeconds: maximum time a cache item will stay in the cache if it's not used
timeToLiveSeconds: maximum lifetime for a cache item, no matter how much it's used
To change the values for both timeToLiveSeconds and timeToIdleSeconds find the cache names adhocCache under /apache-tomcat/webapps/jasperserver-pro/WEBINF/adhoc-ehcache.xml
<cache name="adhocCache" timeToIdleSeconds="1800" timeToLiveSeconds="5400" overflowToDisk="false" diskPersistent="false" statistics="true" > <searchable> <searchAttribute name="id" expression="value.getId()"/> <searchAttribute name="lastAccessTime" expression="element.getLastAccessTime()"/> <searchAttribute name="creationTime" expression="element.getCreationTime()"/> <searchAttribute name="hitCount" expression="element.getHitCount()"/> </searchable> </cache>
Prior to version 5
In the applicationContext-adhoc.xml Spring configuration file, there are two parameters for when to clear the cache.
The defaultTimeoutMinutes and defaultUnusedTimeoutMinutes properties, both in the dataSetCache bean, can be modified:
The number of minutes to wait before removing a dataset from the cache. Ensures that stale data is periodically replaced with fresh data from the data source. The default is 60 minutes.
- defaultTimeoutMinutes: The number of minutes to wait before removing a dataset from the cache. Ensures that stale data is periodically replaced with fresh data from the data source. The default is 60 minutes. So if the value is set to something below 60, then it might be worthwhile testing it by setting it to the maximum value.
- defaultUnusedTimeoutMinutes: The number of minutes to wait after a dataset is used before removing it from the cache. The default is 20 minutes. You might try setting this value to a higher value (something higher than the default 20).
For more on these parameters, and Managing Ad Hoc Caching in general, refer to the latest documentation: JasperReports Server Admin Guide.
Other Performance Tips:
Measure and Test
Ad Hoc
Tomcat
- Compress HTTP responses at the Tomcat level
- Increase the maximum thread count at the Tomcat level
- Set up a cache filter for Tomcat or JBoss
- Disable automatic deployment on production servers using Tomcat
Database
- Index columns in the database to speed up domain-based reports
- Set the fetch size in the jasperreports.properties file to modify the number of rows to fetch
Recommended Comments
There are no comments to display.
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 accountSign in
Already have an account? Sign in here.
Sign In Now