当前位置:网站首页>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
边栏推荐
猜你喜欢

带来高价值用户体验的低代码开发平台

C language: clion debugging method

4 轮拿下字节 Offer,面试题复盘

Chinese character search Pinyin wechat applet project source code

一种比读写锁更快的锁,还不赶紧认识一下
Dry goods of technical practice | preliminary exploration of large-scale gbdt training
![[basic knowledge of deep learning - 46] Bayesian theorem and conditional probability formula](/img/9f/b9d7503404e068495fd8613df29366.png)
[basic knowledge of deep learning - 46] Bayesian theorem and conditional probability formula

c语言:7、c语言多源码文件使用方法

Cumulative output data of kettle Excel

Golang sets the domestic image, vscode configures the golang development environment, and vscode debugs the golang code
随机推荐
Map and set
C language: 5. Multidimensional array
go-zero单体服务使用泛型简化注册Handler路由
反超华为?爱立信已拿下超过75份5G商用合同
记一次无准备的实习面试
Responsibility should be assigned to people, and Guangzhou should take multiple measures to build a "safety line" for children in summer
Optimization of fixed number of cycles in embedded C language
ReferenceError: __dirname is not defined in ES module scope
c语言:8、makeFile编写
C language: 15. Structure
发布自己的npm组件库
【日常积累 - 07】cuda多版本切换
ReferenceError: __ dirname is not defined in ES module scope
[deep learning target detection series - 01] what is target detection
HDU1171_ Big event in HDU [01 backpack]
C language: 8. Makefile preparation
汉字查拼音微信小程序项目源码
三星将推多款RISC-V架构芯片,5G毫米波射频芯片会率先采用
5W bonus pool / for colleges and universities, 2022 legal science and technology innovation competition is in progress
全球手机芯片设计领域首家!紫光展锐荣膺TMMi4级国际认证