The Java Monitoring and Management Console - or simply called as jconsole is an advanced tool for Java developers to monitor and manage their Java Applications that are deployed on their local machine, or remote machines such as UAT (Staging) or Production environment. This tool comes very handily when there the developer wants to understand the following,
- What is the trend of the memory (heap) consumption of the application.
- To identify number of threads that are running (live threads).
- Total number of Classes that are loaded and currency in use.
- What is the trend of CPU utilization of the application over time.
How to Lauch jconsole using command Line?
Launching the monitoring tool is easy. just type jconsole in the command line (or Terminal if using Mac/Linux). You can also pass in optional parameters such as PID to launch the console with details of a JVM that you want to monitor.Syntax: jconsole [ options ] [ connection ... ]
When you fire this command the jconsole UI application will be launched and you will see something like this.
⚡️You can select the time range from 1 minute, 5 minutes, 10 minutes, 30 minutes, 1 hour .. 1 day, ... 1 month, ... 12 months... All based on what time the issue might have occurred that you want to understand.
jconsole various tabs
- Overview tab: Shows the graphs of Heap Memory Usage, Threads, Classes and CPU Usage,
- Memory tab: In this tab, you can see detailed charts of all kinds of memory areas such as Heap, Non-Heap, and various Memory Pool. You can also perform garbage collection here.
- Threads tab: It provides detailed information of all the threads - you can look into the thread stacks and even identify deadlocks here.
- Classes tab: Again this provided more detailed info about the classes loaded and their charts.
- VM Summary tab: It looks something like this,
VM Summary Saturday, April 24, 2021, at 6:09:59 PM GMT Connection name: pid: 5401 jdk.jconsole/sun.tools.jconsole.JConsole Virtual Machine: OpenJDK 64-Bit Server VM version 22.214.171.124+1-LTS Vendor: Azul Systems, Inc. Name: firstname.lastname@example.org Uptime: 22 minutes Process CPU time: 1 minute JIT compiler: HotSpot 64-Bit Tiered Compilers Total compile time: 27.076 seconds Live threads: 38 Peak: 39 Daemon threads: 30 Total threads started: 51 Current classes loaded: 5,156 Total classes loaded: 5,158 Total classes unloaded: 2 Current heap size: 69,452 kbytes Maximum heap size: 2,097,152 kbytes Committed memory: 516,096 kbytes Pending finalization: 0 objects Garbage collector: Name = 'G1 Young Generation', Collections = 357, Total time spent = 0.446 seconds Garbage collector: Name = 'G1 Old Generation', Collections = 0, Total time spent = 0.000 seconds Operating System: Mac OS X 11.2.3 Architecture: aarch64 Number of processors: 8 Committed virtual memory: 414,543,728 kbytes Total physical memory: 8,388,608 kbytes Free physical memory: 61,648 kbytes Total swap space: 2,097,152 kbytes Free swap space: 794,624 kbytes VM arguments: -Dapplication.home=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home --add-opens=java.base/java.io=jdk.jconsole -Djconsole.showOutputViewer -Djdk.attach.allowAttachSelf=true -Xms8m -Djdk.module.main=jdk.jconsole Class path: Library path: /Users/code2care/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. Boot class path: Unavailable
Have Questions? Post them here!
- [Java Threads] Should we extend Thread Class or implement Runnable interface
- Java TLSv1.3 protocol code example using SSLSocket
- How to get list of all Java versions installed on macOS
- Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end users experience
- [Java] Error: Unmappable character for encoding UTF-8. Save could not be completed.
- Tutorial Java SOAP WebServices JAS-WS with Eclipse J2EE IDE and Tomcat Server Part 1
- Maven Unsupported major.minor version 51.0
- Java: The value of the local variable string is not used
- Unsupported major.minor version 52.0 in java
- 5+ Fibonacci number Series Java Program Examples [ 0 1 1 2 3 ..]
- Simple Struts 2 Tutorial in eclipse with tomcat 7 server
- Maven BUILD FAILURE: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin
- IntelliJ: Error: Could not find or load main class, java.lang.ClassNotFoundException
- SharePoint Open in the client application document opens in browser
- Java Leap Year Programs with Code Examples
- Remove Trailing zeros BigDecimal Java
- How to run Java Unit Test cases with Apache Maven?
- Convert String to int in Java
- Java Split String by Spaces
- Setting Java_Home Environment variable on Windows Operating System
- List of jar files for Jax-ws (SOAP) based Java Web Services
- Fix java.net.ProtocolException: Invalid HTTP method
- Maven Eclipse (M2e) No archetypes currently available
- Add newline character Java code example (\r \n \r\n)
- JSP Hello World Program Tutorial with Eclipse and Tomcat Server
- AVD Pixel_2_API_15 is already running. [Android Studio] - Android-Studio
- Flash Player will no longer be supported after December 2020. Turn off [Google Chrome] - Chrome
- Installing vue.js in Laravel 8 - PHP
- 10 Beginners Commands for macOS Terminal Usage - MacOS
- JSON Datatypes : Tutorial - Json-Tutorial
- How to find AUTO_INCREMENT Fields value in MySQL table - MySQL
- How to change bash terminal prompt string and color - Linux
- Google translate in spreadsheet - Google
- Add Bookmark macOS Safari - MacOS
- 11 Weeks of Android Online Sessions-15-Jun-to-28-Aug-2020 - Android
- Multiline EditText in Android Example - Android
- How to make TextView Text Transparent [Android] - Android
- Add imports in eclipse shortcut key combinations - Eclipse
- Calculate Volume of Cone - C-Program
- John Robert Lewis dies at 80 - News
- Device not compatible error Android Google Play Store - Android
- How to use Spotlight feature in Teams meeting to pin and highlight participant and content - Teams