Methods for Extracting Java Heap Values and Monitoring Java Heap Usage in WebSphere
DavidLaraman 270004BMB2 Visits (2941)
There are a few methods or ways to verify Configured Heap Values and monitor Current Heap Usage in WebSphere Application Server as well as a few different dump and file types useful for this task.
Useful Dumps and Files containing information about your Java Heap.
Javacores txt files are useful to determine Initial, Maximum and Current Heap values along with Threading and Locking information and even include a Native Memory usage section. They are generally used to track Abends, Hangs, Out of Memory, GPF Crash, and Trace Assert type conditions.
Useful Methods to generate the above referenced Dumps and Files for Monitoring the Java Heap.
1.) Generate a Javacore manually from the Command line or a DOS box.
a. Execute a kill -3 or kill -quit command on Unix generates Javacore or Threaddump, which contains the following Java Heap information including Initial Heap, Maximum Heap, Total Heap, Heap in use, and Heap Free:
Total memory in use:
Total memory free:
You can also use our Dump Agent as a Generic JVM Arg to specify which dumps to generate on the kill -3 command:
-->> system+snap parameters can also be used if needed to specify additional System Coredump an Java Snap Traces, system dumps are generally speaking very large requiring proper ulimit setup (ulimit -c -f unlimited for hard and soft values) on Unix or enough file system space on windows and also need to be Jextracted to include required local libraries necessary for out Tooling to process these binary files.
b. CTRL+BREAK can be used on Windows to generate Javacore dumps, but the user needs to create a special startup script first for the JVM.
1. Open the command prompt.
c. Invoke WSAdmin user interface from a Command prompt or DOS box against the SOAP port for AppServer or DMgr to generate a Javacore or Threaddump.
2.) Generate Javacore and Heapdump manually from WebSphere Administrative or Integrated Solutions Console in Full Profile or using javadump command in Liberty Profile.
a. Example in Full Profile using GUI or WUI Console:
b. Example in Liberty Profile using javadump command:
Assume <server_name> = server1
*** Analyzing Viewing resulting Javacore or Heapdump output ***
Javacores are Plain Text or Ascii files so can be read with any Editor of your choice and do not require additional tooling or formatting. You can also use Thread and Monitor Dump Analyzer if you prefer a GUI front end and this does have the advantage of processing multiple Javacores at one time, performing Threads and Monitor Locks comparisons and so forth, so it can be a very practical and useful tool.
Heapdumps are Binary Files and require one of the following tools to format them for analysis:
Memory Analyzer (MAT) or Heap Analyzer (HA)
Most of these tools can be downloaded as separate eclipse EXEs or java JARs or can also be used in conjunction with IBM Support Assistant tooling as Plugins, see 5.) below for more information regarding ISA download.
3.) Enable VerboseGC, which would be very little or no overhead associated, since the calculations were previously performed during the actual GC runtime.
* You can use GCMV or PMAT standalone or eclipse plugins to analyze view the resulting output.
IBM Monitoring and Diagnostic Tools - Garbage Collection and Memory Visualizer (GCMV
IBM Pattern Modeling and Analysis Tool for Java Garbage Collector
4.) Setup and use built-in PMI Request Metrics or more specifically Counters for monitoring java heap usage, just need to configure and setup.
Java Virtual MachineCounter Definitions:
You can use the Java virtual machine (JVM) counters that the Performance Monitoring Infrastructure (PMI) and Tivoli® Performance Viewer (TPV) collect to monitor JVM performance.
The total, used, and free heap size counters are available without any additional configuration settings. The remaining counters are available only when a Java virtual machine profiler is enabled.
Enabling the Java virtual machine profiler data
e. g. Heap and Garbage Collection related counters...
5.) Download and use IBM Support Assistant or Team Server, and use the Java HealthCenter and appropriate Plugins (Tools):
ISA IBM Support Assistant:
IBM Support - IBM Support Assistant Team Server
Problem Determination Tools for IBM Support Assistant Team Server 5
Tools or Plugins Available for ISA:
FileNet Optical Storage and Retrieval (OSAR) Cable Tool
Garbage Collection and Memory Visualizer (GCMV)
Java Health Center
Heap Analyzer (HA)
Interactive Diagnostic Data Explorer (IDDE)
Memory Analyzer Tool (MAT)
Pattern Modeling and Analysis Tool for Java Garbage Collector (PMAT)
Portal Log Analyzer
Profile Port Checker
Processor Time Analysis Tool for Linux
Serviceability Tool for Sametime
Thread and Monitor Dump Analyzer for Java (TMDA)
Trace and Request Analyzer for WebSphere Application Server
WAIT Javacore Analyzer
Web Server Plug-in Analyzer for WebSphere Application Server
WebSphere Application Server Configuration Visualizer
WebSphere Cross Component Trace Logviewer
6.) Using WSAdmin Command-Line Interface:
a. Check pre-configured Initial and Maximum Heap size values if explicitly set.
wsadmin Script to check the JVM heap size of a WebSphere Server:
# Usage: wsadmin -f getJvmHeap.py server
server = Admi
jvm = Admi
print 'initialHeapSize: ' + Admi
print 'maximumHeapSize: ' + Admi
b. Check current runtime Total, Free and Maximum Java Heap Memory values.
Get current system data by running wasadmin.sh as follows.