Search This Blog

Monday 15 February 2016

Generate Heap Dump using java Visual VM



  • A Heap Dump is a snapshot of the Java process heap memory at a given time
  • It is a useful tool to troubleshoot memory leaks and other memory related issues
  • Heap Dump is used to analyse the objects state in a JVM ,usually we analyse Heap Dump during out of memory error
Steps:
  • Go to $JAVA_HOME/bin
  • Run the command ./jvisualvm
    

bin
Invoking Visual VM from the Java Installation

  • After running the command ./jvisualvm command it automatically opens java VisualVM  window

./jvisualvm
Java VisualVM
  • Next open the process id(pid)
weblogic
Open the MBean by selecting  WebLogic Pid
  • Click on Monitor Tab --> Heap Dump Tab
Heap Dump
Click on Heap Dump Tab
  • Click on classes then Java VisualVM enables us to browse Heap Dumps as shown below with the classes view where we can identify the number and percentage of instances referred by each class.

view
Percentage of instances referred by each class


Generate Thread Dumps in WebLogic 12C using WLST & Admin Console

Thread Dump is a snapshot of the state of all Threads That are part of the process.
Thread dumps are one of the very important JVM reports , which we can use to analyse server/JVM hang situations and the root cause of it.

Pre - requisites for this experiment:

  • WebLogic installed
  • Domain Configuration
  • AdminServer,Managed Servers Running state

There are 2 ways to Generate Thread Dumps in WebLogic:

1) From WebLogic Admin Console
2) Using WLST commands


1) ThreadDump from WebLogic Admin Console:
  • Open Servers tab in Admin Console
  • Select Admin/Managed Servers
  • Select Monitoring -> Threads tab
  • Then click on Thread Dump ->Dump Thread Stacks



Thread Dump
Generating Thread Dumps using Admin Console


2) Using WLST commands:

  • Set the CLASS PATH by using Environment variables("java weblogic.WLST") to connect WLST
  • Then it will connect to wls:/offline> 
  • connect("username","password","url:port")
  • Example:  connect("weblogic","welcome1","192.168.136.128:7001")
  • threadDump()
WLST:


WLST
Thread Dump using WLST

Output :  Thread Dump for AdminServer

Output
Thread Dump for WebLogic AdminServer




WebLogic Books

  • Oracle WebLogic Server 12c: Administration Handbook
  • WebLogic Diagnostic Framework
  • Advanced WebLogic Server Automation
  • Oracle SOA Suite 11g Administrator's Handbook

Popular Posts