当前位置:网站首页>Use of jvisualvm
Use of jvisualvm
2022-07-27 19:45:00 【fen_ fen】
jvisualvm Use
VisuaIVM(All-in-One Java Troubleshooting Tool) It's a free one , Integrated multiple JDK Visualization tools for command line tools , It provides powerful analytical capabilities , Yes Java Application performance analysis and tuning . These functions include generating and analyzing massive data 、 Tracking memory leaks 、 Monitor the garbage collector 、 Execution memory and CPU analysis , At the same time, it also supports MBeans Browse and operate on . It is by far the most powerful operation monitoring and fault handling tool .
1、Windows Monitor the local JVM
1.1、 First you need to configure JAVA Environmental Science
1.2、 Get into jvisualvm Catalog , route :%JAVA_HOME%/bin Below jvisualvm, double-click jvisualvm.exe, Popup page

1.3、 In the interface above ” Local ” in , Select the to be monitored JAVA process , Click to connect

monitor : It shows the current system CPU、 Memory 、 Usage of resources related to classes and threads . among " Pile up dump" You can view the detailed status of the heap , Including the overview of the heap , All classes inside , You can also click into a specific class to view the status of this class .
Threads : It can display the name and running status of the thread , It is necessary to debug multiple threads , And you can click a thread to see the detailed running status of this thread
2、 Remote monitoring JVM(Tomcat Example )
remote server :centos7 middleware :Tomcat
3.1、 Server side Tomcat To configure
1、Tomcat Of catalina.sh Need configuration , restart tomcat
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=10.1.1.145" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9000" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.rmi.port=9000" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false" |
remarks
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=10.1.1.145" // Appoint jconsole Connected IP
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9000" // Appoint jconsole Connection port
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.rmi.port=9000" // This sentence must be added , You cannot succeed without adding
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false" // close ssl authentication
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false" // close User password authentication
other jar Package application , Add... To the startup file :
nohup java -Djava.rmi.server.hostname=10.1.1.145 -Dcom.sun.management.jmxremote.port=9000 -Dcom.sun.management.jmxremote.rmi.port=9000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar xxx.jar &
2、 modify /etc/hosts
Comment out 127.0.0.1
newly added :10.1.1.145 localhost localhost.localdomain

3、 see 9000 Does the port have
$netstat -ntlp

4、jvisualvm monitor
Click on ” file ”, choice “ add to JMX Connect ”



jvisualvm Access with a password
1、 Modify in the server configuration :authenticate=true
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.pwd.file= // Specify the correct password file
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=10.1.1.145" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9000" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.rmi.port=9000" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=true" JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.pwd.file=/home/cg/java/jdk1.8.0_221/jre/lib/management/jmxremote.password" |
2、 take Jdk/jre/lib/management Under the jmxremote.password.template, A copy is called jmxremote.password. Go in and delete all the contents , Add a row
monitorRole 123456 //( user name , password )
controlRole 123456 //( user name , password )
remarks :monitorRole and monitorRole The user is already jmxremote.access To configure ( Templates )
3、 take jmxremote.password and jmxremote.access Change to 600 jurisdiction , And the user of the program
chmod 600 jmxremote.access jmxremote.password
4、jvisualvm Use user name and password to access ( for example :controlRole/123456)

Because it is not configured SSL, So here is

Normal monitoring :

other : If you do not enter the user name and password , The user name and password required will pop up automatically

Reference resources :https://www.jianshu.com/p/0308983dc04c
边栏推荐
- Yanghui triangle
- A lock faster than read-write lock. Don't get to know it quickly
- 嵌入式C语言循环展开
- 低代码实现探索(四十五)业务参数
- rxbinding
- Flink简介以及运行架构
- 台积电5nm即将量产:苹果A14独占7成产能,华为麒麟1020拿下3成
- [deep learning target detection series - 01] what is target detection
- C language: C language code style
- Optimization of embedded C language for indefinite cycles
猜你喜欢

Binary search tree

C language: 14. Preprocessing

redis底层数据结构详解

让你的聊天气泡丰富多彩

Come to sword finger offer 03. Repeated numbers in the array

Release Samsung 3J1 sensor: the code implies that the safety of pixel 7 face recognition will be greatly increased

原厂PW4203降压型1-3节锂电池充电芯片

一种比读写锁更快的锁,还不赶紧认识一下

【深度学习基础知识 - 42】逻辑回归详解

Original pw4203 step-down 1-3 lithium battery charging chip
随机推荐
Basic network faults and troubleshooting
Introduction to Flink operator
C language: 10. Input stream, output stream, error stream
Take byte offer in four rounds and answer the interview questions
ReferenceError: __ dirname is not defined in ES module scope
Incluxdb series (III) detailed explanation of incluxdb configuration file
[deep learning target detection series - 01] what is target detection
零知识证明的硬件加速
Web3.0热浪之下 门萨Mensa生态震撼来袭
HDU1171_Big Event in HDU【01背包】
Fzu1669 right angled triangle
电商商城小程序项目完整源码(微信小程序)
Cumulative output data of kettle Excel
redis底层数据结构详解
嵌入式C语言循环展开
Complex number proof of solvability of regular 17 sided ruler and gauge drawing
C language: 5. Multidimensional array
High cost, difficult to implement, slow to take effect, what about open source security?
[basic knowledge of deep learning - 48] characteristics of Bayesian network
【深度学习基础知识 - 43】优势比的概念