Master JVM Performance: Visual Tools, JConsole, VisualVM & Arthas Guide
This guide introduces JVM performance monitoring by explaining built‑in tools like JConsole and VisualVM, showcasing third‑party solutions such as Arthas, and providing step‑by‑step commands and screenshots to help developers quickly visualize and troubleshoot Java applications.
01. Background Introduction
Through GC log analysis and related tuning commands, developers can quickly query online service performance and troubleshoot issues. However, memorizing these commands is difficult unless used frequently. Most developers prefer a visual interface to display performance metrics and import dump files for analysis.
02. JDK Built‑in Tools
2.1 jconsole
2.1.1 Startup
Run
jconsolefrom the command line, or double‑click
jconsole.exeon Windows. The UI allows selecting a local JVM or connecting to a remote JVM via JMX.
For remote Tomcat monitoring, add the following JVM options:
-Dcom.sun.management.jmxremote.port=6969
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false2.1.2 Memory Panel
The memory panel shows heap and non‑heap usage, allows triggering GC, and visualizes memory changes.
2.1.3 Thread Panel
The thread panel displays active and peak thread counts, thread details, and dead‑lock detection.
2.1.4 Class Panel
The class panel shows the number of loaded classes.
2.1.5 VM Summary Panel
The VM summary panel provides an overview of JVM information, including basic info, threads, heap, OS, and VM parameters.
2.1.6 MBean Panel
The MBean panel displays managed bean attributes and operations.
2.2 VisualVM
2.2.1 Startup
Run
jvisualvmfrom the command line or double‑click
jvisualvm.exe. The UI can monitor local or remote JVMs.
2.2.2 Monitor Panel
The monitor panel shows CPU, memory, thread, and class charts, and supports manual GC and heap dump generation.
2.2.3 Thread Panel
The thread panel displays thread activity counts.
2.2.4 Sampler Panel
The sampler panel samples CPU and memory usage over time for analysis.
2.2.5 Plugin Installation
VisualVM supports installing plugins (e.g., Visual GC) via Tools → Plugins. Add the plugin center URL
https://visualvm.github.io/pluginscenters.htmlif needed.
https://visualvm.github.io/pluginscenters.html03. Third‑Party Tools
MAT – powerful Java heap analyzer for memory leak detection.
GCeasy – online GC log analyzer with real‑time analysis.
GCViewer – free GC log visualizer.
JProfiler – commercial performance profiler.
Arthas – open‑source online diagnostic tool.
3.1 Arthas
3.1.1 Startup
Download the jar and run
java -jar arthas-boot.jar. After startup, select the target Java process.
3.1.2 Dashboard
Use the
dashboardcommand to view thread, memory, and runtime information.
3.1.3 thread Command
Query a specific thread, e.g.,
thread 16, or list all threads with
thread -all.
3.1.4 jad Command
Decompile a class to verify source code, e.g.,
jad com.example.boot.Application.
3.1.5 watch Command
Observe method return values, e.g.,
watch com.example.boot.test.web.TestController queryAll returnObj.
04. Summary
This article consolidates knowledge about JVM visual analysis tools, covering built‑in utilities (jconsole, VisualVM) and popular third‑party solutions (Arthas), and provides practical usage examples to help developers monitor and troubleshoot Java applications efficiently.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.