You are currently on IBM Systems Media’s archival website. Click here to view our new website.


Bookmark and Share
RSS

Recent Posts

i Can ... Work With Your JVMs

August 30, 2009

This week's post was written by Arv Fisher. Arv is the team leader of the Java development team in the IBM i development lab. Thanks, Arv!

 

Have you ever wanted to check the current garbage collection (GC) heap size, check GC performance or display the parameters the JVM was started with? If you have environments that use Java, these questions as well as many others probably come to mind.

The IBM i 6.1 release has three new commands to assist in answering your JVM environment and performance questions:

 

  • Work With JVM Jobs (WRKJVMJOB)
  • Print JVM Job (PRTJVMJOB)
  • Generate JVM Dump (GENJVMDMP)

 

 

 

The new commands can be used on any job where an IBM Technology for Java (IT4J) VM is currently running.

By default WRKJVMJOB will list all the currently active JVMs regardless of how they were started. GC information, JVM arguments, environment variables, thread information including Java thread names, the capability to see the Java stack frames, native heap sizes and more are available using WRKJVMJOB. (One thing that's really cool here is the environment variables for the job-until WRKJVMJOB, there was no interface to easily display the environment variables of a job other than your own! So WRKJVMJOB has some interesting function beyond just working with JVMs!)

When JVM performance is being investigated, GC information is a requirement. Most will validly choose not to run with verbose GC enabled all the time, and having to restart the JVM just to enable verbose GC isn't always an option. IBM i always keeps track of the last 300 GC cycles for each IT4J JVM. Just use WRKJVMJOB to print the GC Cycle Table to a spool file. The GC information in the spool file is in a somewhat readable form or IBM Support Assistant (ISA) Version 4 can access IBM Monitoring and Diagnostic Tools for Java -- Garbage Collection and Memory Visualizer (GCMV) -- to analyze the GC information. If you have your own favorite tool that analyzes the traditional verbose GC information you can specify -verbosegc on the Java command line or just use WRKJVMJOB to enable or disable verbose GC at any time. On IBM i, we allow you to collect GC information even when the JVM was not started with verbose GC enabled.

Interested in performing an analysis of the Java objects that exist in the GC heap? Use WRKJVMJOB to simplify the task. To perform an in-depth heap analysis, you need to generate a heap dump. In the past on IBM i and on other platforms, you had to start the JVM with some special Xdump options, find the process identifier of the JVM and then issue a command that looked like "kill -QUIT 5342". I know you were thinking the first time you issued the command and probably still do today, "What were they thinking?". On IBM i, we agreed and thought we can help. Without starting up the JVM with any special options, use WRKJVMJOB to request any IT4J JVM to generate a heap dump. We also have the capability to generate a Java or System dump if you run into a situation where it's necessary. Once you have your heap dump, you can use ISA Version 4 to get access to the tool Memory Dump Diagnostic for Java (MDD4J) to analyze the GC heap. There are times when the special Xdump options may be necessary. They still can be specified on the Java command line as you would have done in the past. We have also provided an option in WRKJVMJOB on the Work With JVM Jobs panel (12=Dump) to generate a dump using the options specified on the Java command line.

WRKJOB also has a new option, 45, to invoke WRKJVMJOB if that job has an active JVM. Experiment with WRKJVMJOB; you'll probably find information that can be helpful and is readily available. Be sure to load the latest Java Group PTF to get the most current version of the commands.

The new commands don't support the Classic JVM. IT4J will be the only JVM supported in the follow-on release to 6.1. See the Upgrade Planning Statement for the Java Developer Kit for additional information. 

The complete list of options for WRKJVMJOB is available at the Information Center.

PRTJVMJOB allows you to target a specific JVM and lets you directly print the information you can display under WRKJVMJOB. The complete list of options for PRTJVMJOB is available at the Information Center.

GENJVMDMP allows you to target a specific JVM and request it to generate a Java, System or Heap dump. The dump options are also available under WRKJVMJOB. The complete list of GENJVMDMP options is available at the Info Center.

Additional information on ISA version 4 can be found at the IBM Education Assistant Web site

Posted August 30, 2009| Permalink

-->