NonStop Server for Java 6.0 Programmer's Reference
dump information. If the -XX:+HeapDumpOnly option is specified or the _JAVA_HEAPDUMP_ONLY
environment variable is set, the heap dump functionality is triggered by sending SIGWINCH to
the process. The printing of thread and trace information to stdout is suppressed.
The heap dump is written to a file with the following filename format:
java_<pid>_<date>_<time>_heapDump.hprof.txt.
The default output format is ASCII. The output format can be changed to hprof binary format by
setting the _JAVA_BINARY_HEAPDUMP environment variable. This environment variable can also
be used with the -XX:+HeapDump option to generate hprof binary format with the SIGQUIT signal.
Using Heap Dumps to Monitor Memory Usage
By creating a series of heap dump snapshots, you can see how the number and size of objects
varies over time. It is a good idea to collect at least three snapshots. The first one serves as a
baseline. It should be taken after the application has finished initializing and has been running for
a short period. The second snapshot can be taken after the residual heap size has grown
significantly. You can monitor the residual heap size using -Xverbosegc and HPjmeter. Take the
last snapshot just before the heap has grown to a point where it causes problems resulting in the
application spending the majority of its time doing full GCs. If you take other snapshots, spread
them out evenly based on residual heap size throughout the running of the application. The leak
is easier to track down if the difference in size between heap dumps is large.
After you have collected the snapshots, read them into HPjmeter (run with -Xverbosegc to monitor
memory usage).
When creating heap dumps, running the application with smaller heap sizes will result in smaller
heap dump files. Smaller heap dump files enable HPjmeter analysis to use less memory. Read two
files in HPjmeter and compare them using the File->Compare option. You should be able to find
out the types of objects that are accumulating in the Java heap. Select a type using the Mark to
Find option and go back to a view of one of the snapshots. Go to the Metric->Call Graph Tree
option and do a Find. You should be able to see the context of the object retention.
JVM Tuning Tools
PrintGCStats is a tool for mining “verbose:gc” logs that can aid analyzing and tuning garbage
collection. You can download this tool from the following location:
http://java.sun.com/developer/technicalArticles/Programming/turbo/PrintGCStats.zip
Additionally, for a discussion of profiling tools, see “Application Profiling” (page 76) section.
Tuning Application Performance
The topics are
• “Memory Considerations: Moving QIO to KSEG2” (page 66)
• “Determining the Heap Manager” (page 68)
• “Determining the Heap Setting” (page 68)
• “Related Tuning Guides” (page 69)
Memory Considerations: Moving QIO to KSEG2
Java server-side applications are typically configured with large Java heap sizes, in excess of 128
MB. In addition, the JVM and its native components (for example, NonStop Servlets for JavaServer
Pages (NSJSP) transport library, JDBC Driver for SQL/MP, JDBC Driver for SQL/MX, SQL/MX
call-level interface, and potentially any custom-user JNI code) allocate memory for their own use.
Thus, the overall heap space required by a JVM process can be considerably higher than the
configured Java heap space.
66 Implementation Specifics










