This is a list of tips and tricks that we're compiling that people have used successfully in their JasperReports® Server projects. Some entries in this list are links to other pages rather than having the entire text in-line. Eventually, these entries will wind up on their own page as well.
Please add any other bits that you've used as an in-line entry or as a link to a separate page.
Measure and Test
Move static content to a web server. Some customers have reported up to 20% improvement in response time.
Data Source Connections
Prefer JNDI datasources to JDBC datasources
One potential bottleneck is a datasource that doesn't offer a connection pool. This is why we recommend using JNDI, which allows you to configure an entire connection pool that resides within the container.
A JNDI data source calls the JNDI (Java Naming and Directory Interface) service of the application server to locate a database connection. The application server manages the connections to the database and shares them between all applications that it hosts. The configuration of the application server determines the number of connections that are shared. Note that the application server connects to the database using JDBC, meaning that JNDI data sources return results in the same format as JDBC data sources.
In Tomcat, tuning the JNDI datasource involves modifying the values for the maxIdle and maxActive attributes. For more information, see How to Tune the number of connections in the server database pool, which gives examples of configuring a connection pool.
JasperReports Configuration Items
- Check and veriify that jprint size calculations are turned off. This incurs a major performance hit to both memory and cpu.
The file is located at /WEB-INF/js.config.properties.
#enable recording of print object memory size
File system issues
Although it doesn't happen very often, sometimes the filesystem on which JasperReports Server is running needs some tuning. Some common issues that may occur are:
File System Full
On Linux-based systems, you can check the filesystem size and its usage by using the command below, which gives you a report on the filesystem usage.
$ df -k
If there is no swap space defined for a system, or if there's not enough, then the system will often seem to using all its memory even if the CPU % usage is low. This is because it's unable to idle processes by using swap space (essentially writing their state to disk, for quick retrieval when another process needs it). Swap space gets defined as a fraction of available RAM; some people prefer 50% of RAM for large systems, others 200% of RAM. Remember that this is disk space and not additional RAM.
You can use this command on Linux to check the swap space:
Continue with Performance Topics: