Java monitoring and management console [jconsole]

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.

Java monitoring and management console
Java monitoring and management console

⚡️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

  1. Overview tab: Shows the graphs of Heap Memory Usage, Threads, Classes and CPU Usage,
  2. 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.
  3. Threads tab: It provides detailed information of all the threads - you can look into the thread stacks and even identify deadlocks here.
  4. Classes tab: Again this provided more detailed info about the classes loaded and their charts.
  5. 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/
    Virtual Machine: 
    OpenJDK 64-Bit Server VM version
    Azul Systems, Inc.
    22 minutes
    Process CPU time: 
    1 minute
    JIT compiler: 
    HotSpot 64-Bit Tiered Compilers
    Total compile time: 
    27.076 seconds
    Live threads: 
    Daemon threads: 
    Total threads started: 
    Current classes loaded: 
    Total classes loaded: 
    Total classes unloaded: 
    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
    Number of processors: 
    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/ -Djconsole.showOutputViewer -Djdk.attach.allowAttachSelf=true -Xms8m -Djdk.module.main=jdk.jconsole 
    Class path: 
    Library path: 
    Boot class path: 

Have Questions? Post them here!
Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap