Turning Jasper Community Server on

——-

The Jasper Server community edition is great for generating PDF and Excel reports. It provides

easy reporting and analytics capabilities. But it’s not tuned for performance out of the box. We recently built a reporting application that had to send out more than 3000 concurrent scheduled reports each day. This article details out performance tuning to achieve the requirement.

The Jasper Server is a beast that moves very slow out of the box. It could handle about 100 concurrent report requests. After that it would fail and that too silently. The community wiki has a nice page for improving the performance. Here’s what worked for us.

Configuring a connection pool for a JNDI data source

Jasper Reports Community recommends using JNDI data source to configure connection pool within the container. Head to /jasperserver/META-INF/context.xml file under Tomcat. In context.xml, tune the jdbc/jasperserver resource, and modify the following attributes as per your need

  1. maxActive: Maximum number of dB connections in pool. By default it’s value is 100. Set to -1 for no limit.
  2. maxIdle: Maximum number of idle dB connections to retain in pool. By default it’s value is 30. Set to -1 for no limit.
  3. maxWait: Maximum time to wait for a dB connection to become available in ms. By default it’s value is 10000. Set to -1 to wait indefinitely.

Configuring JVM options of tomcat

Default setting of JVM options is not suitable for production environment. To change JVM options you will have to modify JAVA_OPTS variable in JASPER_SERVER-DIR/apache-tomcat/bin/setenv.xml file. Modify heap and stack size according to RAM of machine

  1. Xms: Minimum heap size to start with. It has no default value.
  2. Xmx: Maximum heap size. It typically has a default value of 256MB. It should be set to 50% of available RAM on the system.
  3. Xss: It represents stack size and is used to limit how much memory a stack consumes.

Configuring Postgresql

For tuning Postgresql for production environment as default settings are not suitable for production, change following properties in JASPER_SERVER-DIR/postgresql/data/postgresql.conf file as per your need

  1. max_connections: Maximum number of database connections to have at any time. Default value is pretty low for production environment.
  2. shared_buffers: Default value is quite low, this should be set to roughly 25% of available RAM on the system.

Very Large Reports

You can increase the value of property maxSize in /jasperserver/WEB-INF/applicationContext.xml. However, you need to be careful with the values.