By Laurent Goldsztejn-Oracle on Jan 18, 2013
A variety of free troubleshooting and debugging tools exist but which ones are really useful when analyzing issues with WebLogic Server? In this new blog post series, I will talk about some of the best tools that are available, easy to use, free, and very effective in identifying a bunch of issues. In this first post I will cover VisualVM.
VisualVM most recent version, or 1.3.5, was released on 11/13/2012. This tool consists of an user-friendly visual interface for monitoring running JVMs. Multiple instances of WLS or Java can be monitored at the same time by just connecting to running local or remote JVMs. VisualVM needs to run on Oracle Sun JDK 6+, the JDK, not the JRE. VisualVM can be started as follow to specify the JDK to run it it on.
visualvm --jdkhome "JDK_location", or visualvm --jdkhome "d:\jdk160_24"
Alternatively, /etc/visualvm.conf can be modified to specify a desired JDK. After launch, the list of local running Java instances will be displayed on the left panel under applications. In Remote, you can define the host of other running Java instances. By selecting a running server and clicking on open, you should get a screen similar to the following:
In Start Page, online documentation of VisualVM can be easily accessed. Tags next to Start Page are specific to open JVM instances. In my case, you will find a Weblogic Server instance with its process id (pid).
Underneath, Overview reports all JVM settings as well as many system properties including Weblogic specific properties.
Monitor gives access to realtime monitoring of CPU, Heap, Classes and Threads. You can also force a garbage collection (GC) or issue a heap dump for further analysis.
Threads reports all threads activity in realtime but also allows to take thread dumps. All thread dumps will be attached to the relevant application process on the left panel and saved in C:\Users\<user_name>\AppData\Local\Temp\visualvm.dat. Example: C:\Users\lgoldszt\AppData\Local\Temp\visualvm.dat\localhost_6352\threaddump-1358534350679.tdump. Thread dumps can be further diagnosed with ThreadLogic.
In Samplers, you can record CPU or memory usage activity. This is neat to debug potential memory leak and high CPU usage threads.
Finally, Profiler allows to identify where most of the time is being spent and which objects consume most of the memory.
Snapshots of memory can be taken and compared with others, see File - Compare Memory Snapshots.
Also VisualVM comes with a bunch of easy to install plugins as you can see below:
VisualVM doesn't have an MBeans tab like JConsole. However, this can be very easily changed by installing the available VisualVM-MBeans plugin.
With its extensive features, especially including those offered by individual plugin, VisualVM is the tool of choice and combine characteristics of tools such as JConsole, jstat, jmap, or jstack.
For further information and demos please visit VisualVM demo and features.