Introduction
This tutorial covers basic performance diagnostic and tuning techniques for IBM JVM garbage collection. The tutorial focuses on basic memory problems and present command line settings that act as a starting point for improving garbage collection performance when running JasperReports Server.
Product Version
The tutorial works with any version that works with Java 5.0 or later.
Objectives
This guide will enable you to:
- Diagnose memory problems
- Add/Modify JVM command line options to improve garbage collection performance
- Increase heap space and perm gen space as needed
Pre-Requisites
- Basic administration of common J2EE web or application servers (tomcat, JBoss, GlassFish)
- Required permissions to shutdown and restart the server and edit config files
Assumption: Use of bundled Tomcat included with JasperReports Server. Adapt as needed for other application servers and platforms.
Diagnosing Memory Problems
Overview of diagnosing memory problems:
- Launch JConsole
- Have users use JasperReports Server or simulate load with QA tool
- Watch memory usage
Step | Action |
1 | Edit {js-install}/apache-tomcat/bin/setenv.bat |
2 | Add the following JVM options to the JAVA_OPTS variable:
|
3 | Restart JasperReports Server |
4 | Launch the <java-home>/bin/JConsole.exe application |
5 | Click the Remote tab and enter the following values:
|
6 | Click the Memory tab |
7 | Either have users use JasperReports Server or use a load testing tool (such as LoadRunner) to simulate peak load conditions |
8 | Observe the memory usage characteristics. Normal usage will look like this: Whereas a situation where garbage collection is inadequate or nonexistent will look like this: If the “valleys” of the memory usage graph don’t return to a baseline, this is an indication of either a memory leak or garbage collection problem. See the Adding/Modifying JVM Command Line Options section below.
|
Adding/Modifying JVM Command Line Options
Change garbage collection algorithm in use:
- Add/Modify JVM settings
- Restart JasperReports Server
- Watch memory usage
Step | Action |
1 | Edit {js-install}/apache-tomcat/bin/setenv.bat |
2 | Add the following JVM options to the JAVA_OPTS variable, where (n) is between 1 and the number of processors on the server:
|
3 | Restart JasperReports Server |
4 | Either have users use JasperReports Server or use a load testing tool (such as LoadRunner) to simulate peak load conditions |
5 | Watch the <js-install>apache-tomcatwebappsjasperserver-proWEB-INFlogsjasperserver.log |
6 | Watch for OutOfMemoryExceptions |
7 | If an error occurs change the JVM heap space setting. See Increasing Heap Space and Perm Gen Space section below. |
Increasing Heap Space and Perm Gen Space
Change JVM Heap and Perm Gen Settings:
- Add/Modify JVM settings
- Restart JasperReports Server
- Watch memory usage
Step | Action |
1 | Edit <js-install>/apache-tomcat/bin/setenv.bat |
2 | Set the Xms and Xmx options to higher values in the JAVA_OPTS variable. For better performance, set the Xms and Xmx options to the same value. |
3 | Restart JasperReports Server |
4 | Either have users use the system or use a load testing tool (such as LoadRunner) to simulate peak load conditions |
5 | Watch the <js-install>apache-tomcatwebappsjasperserver-proWEB-INFlogsjasperserver.log |
6 | If the errors persist, repeat steps 2-5 until the errors disappear |
7 | If the errors persist after reaching the maximum allowable heap sizes (usually around 1.3 gb), consider migrating to 64 bit hardware or use additional server hardware in a cluster with a load-balancing appliance. |
What's Next?
For additional information, refer to the following:
- JasperReports Server Ultimate Guide
- JasperReports Server Pro Admin Guide, located in the <js-install>docs folder.
- Using JConsole
Written by
This tutorial was written by Steve Park, Professional Services Consultant, June 2009
Recommended Comments
There are no comments to display.