Recently, I investigated performance issues of GlassFish 3. I found that JProfiler 6
is a very handy tool.
In this blog, I would like to share with you what I learnt. I would like to thank Dhiru Pandey and Suveen Nadipalli for their help.
In the following, we will assume GlassFish 3 installed in $GLASSFISH_HOME and JProfiler 6 is running on Mac OS 10.5.8.
Set up GlassFish 3
Note that if one were to debug the GlassFish Web Profile - they would need to change
is filed on this. Once this bug is fixed only
config.properties will need to be modified.
Set up JProfile 6 with GlassFish 3
- Launch JProfiler.
- In Quickstart menu, choose "An application server, locally or remotely".
- Choose integration wizard: choose "Glassfish V3".
- Choose profiled application located: "On this computer".
- JVM settings: (vendor/version/mode). (Note that GlassFish 3 uses JDK "1.6.x".)
- Choose "Wait for connection from the JProfiler GUI".
- Locate the config file:
- Locate the start script:
- Choose the jprofiler port: 8849 (default).
- Click "No".
- JProfile create a script asadmin_jprofiler in
In Mac, you may like to double check that the script has execution permission.
chmod u+x $GLASSFISH_HOME/glassfish3/glassfish/bin/asadmin_jprofiler if necessary.
- Click "Start Center" > "Open Session" > Double click "Glassfish V3 on localhost" > Session Startup: "Cancel"
- Click "Session Settings" > "Filter Settings" > "Excluded"
Make sure that you do not exclude the classes that you want to profile.
For instance, I remove "com.sun.", "org.glassfish.", "org.apache.", "org.jvnet".
Click "OK" to save it.
- Click "Start" for start profiling GlassFish 3.
- For collecting performance data, "CPU Views" > Press to record CPU data
Tips for Viewing and Analyzing Data
- For a given class, the most time consuming method is the first one. In general, one may like to look at the most expensive operation first.
- If one only interests only in profiling certain package, then one can enter the package name in
"View Filters" text box near the bottom of the JProfile screen.
- One can export the tree view of the data into html by clicking "Export" in top menu bar.
- One can save the data for later comparison by clicking "Save Snapshot".
- One can open and compare several snapshots at the same time as follows:
- "Session" > "Open Snapshot" > "New Window"
- Select the snapshot data file (with extension .jps) > "Open"
Can we profile GlassFish 3 with JProfile 5?
One can profile GlassFish 3 with JProfile 5. The setup for GlassFish 3 is the same.
The setup for JProfile 5 is as follows:
- Launch JProfiler.
- Close Quickstart if necessary.
- Click "Start Center" > "New Session".
- Fill in the following information and click "OK".
- Enter the "Session name".
- Choose "Session Type": Local.
- Java VM: 1.6.x
- Working Directory:
- VM arguments:
- Main class executable JAR:
- Then repeat Step 12 to Step 15 of the setup for JProfile 6 above.
Enjoy profiling GlassFish 3.