Performance monitoring tool for troubleshooting visualize JConsole

1.JConsole Profile

   Jconsole (Java Monitoring and Management Console) is a based on JMX (Java Management Extensions) visual monitoring and management tool. Its main function is to collect information and to dynamically adjust the parameters of the system through JMX MBean (ManagedBean).

2.JConsole start

  By the jconsole.exe start jconsole under JDK / bin directory, it will automatically search out all of the virtual machine process the machine running, without requiring the user to use their own jps queries. You can also use the following "remote process" functionality to connect to a remote server, remote virtual machine monitor.

Remote connection Reference: https://www.cnblogs.com/think-in-java/p/6138439.html

3.JConsole Introduction

  3.1 Overview

    Display monitor information CPU usage, memory usage, number of threads, Java VM in the loaded class overview tab. Right single chart can save the data.

  

  3.2 Memory

       Memory tagging "the implementation of GC" button, you can click to perform garbage collection. 

   

  3.3 thread

  In the "thread" in the lower left list lists all active threads. If you enter a string "filter" field, thread list will only display its name contains the string you enter the thread. Click on a name list of threads in the thread, the thread of the right to information is displayed, including the name of the thread, the state, the number of blocking and waiting stack trace.

  Red: peak number of threads
  Blue: the number of active threads

  Deadlock detection thread: To check if your application has reached an impasse running (for example, your application seems to be hung up), the thread deadlock can "detect deadlocks" button detection by clicking. If it detects any thread deadlocks, these are displayed in a new tab appears next to the "Theme" tab

package com.ryj.hotspot;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class JConsoleTest {

    static void createBusyThread() {
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                // TODO Auto-generated method stub
                while (true) {

                }
            }
        }, "testBusyThread");
        t.start();
    }

    static void createLockThread(Object lock) {
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                synchronized (lock) {
                    try {
                        lock.wait();
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            }
        }, "testLockThread");
        t.start();
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        br.readLine();
        createBusyThread();
        br.readLine();
        Object obj = new Object();
        createLockThread(obj);
    }

}
View Code

  

  3.4 Class

 

  3.5VM Overview

 

  3.6Mbean

Guess you like

Origin www.cnblogs.com/ryjJava/p/12633925.html