1) jvisualvm tool installs Visual GC plug-in
1. Find jvisualvm.exe in the local jdk installation path and double-click to open it
2. Select Tools - Plugins - check visual GC
If retrying is displayed, first click Settings-Edit-select the URL of your local corresponding JDK version: https://visualvm.github.io/pluginscenters.html
3. Click remote-add remote host-choose jstat connection-fill in the IP address of the remote server-fill in the port as 1003
2. Configure on the server
1. First find the installation path of jdk, enter the following command to find
ls -lrt /usr/bin/java
cd /etc/alternatives/java
My jdk installation path is: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/bin
2. Then create a file in the bin directory of jdk: vim jstatd-all.policy The contents of the file are as follows:
grant codebase "file:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/lib/tools.jar" {
permission java.security.AllPermission;
};
3. Then create a vim j-start-jstatd.sh file with the following contents:
###########启动 jstatd##############
echo "Hi,即将启动 jstatd 请稍等..."
echo ""
echo ""
echo -e "\033[31m<<<<< 正在为您启动:jstatd 请稍候!!!>>>>>\033[0m"
echo ""
ps -ef|grep jstatd.all.policy |grep -v grep | awk '{print $2}'| xargs -i kill -9 {}
cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/bin
./jstatd -J-Djava.security.policy=jstatd.all.policy -p 10003 -J-Djava.rmi.server.hostname=150.158.xxx.xxx -J-Djava.rmi.server.logCalls=true
4. After starting through the ./j-start-jstatd.sh command, the following is displayed, indicating that the startup is successful
FINER: RMI TCP Connection(5)-113.215.180.xxx: [113.215.180.xxx: sun.tools.jstatd.RemoteVmImpl[-4a24c792:1865478c9f9:-7ff8, 7334292608518085183]: public abstract byte[] sun.jvmstat.monitor.remote.RemoteVm.getBytes() throws java.rmi.RemoteException]
5. The netstat -nltp command displays the following
6. Then start jmeter locally for load or pressure measurement
7. Then you can see some monitoring of JVM in jvisualVM