当前位置:网站首页>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
边栏推荐
- ReferenceError: __dirname is not defined in ES module scope
- 估值超156亿元!华勤通讯完成10亿元B轮融资!高通创投、英特尔资本领投
- Come to sword finger offer 03. Repeated numbers in the array
- 二叉搜索树
- c语言:9、main函数中的return
- influxDB系列(四)TSM引擎(存储原理)
- Count the six weapons of the domestic interface cooperation platform!
- rxbinding
- A lock faster than read-write lock. Don't get to know it quickly
- 【深度学习基础知识 - 44】逻辑回归实现多分类的方法
猜你喜欢

Basic network faults and troubleshooting

IEC104 规约详细解读(一) 协议结构

MFC高级控件之Tab控件( CTabCtrl )

Debian夺回“debian.community“ 域名,喷子仍不善罢甘休
技术实践干货 | 初探大规模 GBDT 训练

带来高价值用户体验的低代码开发平台
Dry goods of technical practice | preliminary exploration of large-scale gbdt training

c语言:13、指针与内存

C language: 14. Preprocessing

C language: 13. Pointer and memory
随机推荐
FZU1669 Right-angled Triangle【毕达哥拉斯三元组】
让你的聊天气泡丰富多彩
【深度学习基础知识 - 47】贝叶斯网络与朴素贝叶斯
[basic knowledge of deep learning - 47] Bayesian networks and naive Bayes
C language: 5. Multidimensional array
C language: 7. How to use C language multi source files
Flink 算子简介
【深度学习基础知识 - 45】机器学习中常用的距离计算方法
Introduction to several wireless protocols
Optimization of embedded C language for indefinite cycles
IIS 发生未知FastCGI错误:0x80070005
反超华为?爱立信已拿下超过75份5G商用合同
IEC104 规约详细解读(一) 协议结构
三星将推多款RISC-V架构芯片,5G毫米波射频芯片会率先采用
爱立信承认在中国等五国行贿,向美支付10.6亿美元罚款
Embedded C language structure
S32k series chips -- Introduction
开启和禁用hyper-v
Incluxdb series (III) detailed explanation of incluxdb configuration file
c语言:14、预处理