This article reads the reading notes for the deep understanding of Java Virtual Machine-JVM advanced features and best practices, and it organizes the performance monitoring and Troubleshooting section of the virtual machine.
About the two parts of the guide map or hope that you can personally test the experience, there are a lot of articles on the Internet, here are excerpts from several individuals think good articles for reference:
- Jstat/jinfo/jstack/jmap command-line tool use detailed introduction
- VisualVM website Introduction and usage instructions
- Performance analysis and tuning with VisualVM
Monitoring remote Linux server Java processes using VISUALVM
Because on the Linux server, the use of Remote Terminal command is not so intuitive, and the server has no desktop display program, can be used on the client (mac/windows/linux) using graphical monitoring tools, before using VisualVM, You must first configure the process start line above the remote server jstatd
, jstatd
please refer to:
The startup method is as follows:
1, in the startup directory to create Files jstatd.all.policy
, add the following permissions control, or will errorCould not create remote object access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write") java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:559) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.System.setProperty(System.java:783) at sun.tools.jstatd.Jstatd.main(Jstatd.java:139)
Add the code content as follows, ${java.home}/../lib/tools.jar
preferably replaced with the address on the machine:
1 2 3
|
"File:${java.home}/. /lib/tools.jar "{ Permission java.security.AllPermission; };
|
2. Background start jstatd
process:
1
|
$JAVA _home/bin/jstatd-j-djava.rmi.server.hostname=192.168. 9.92-j-djava.security.policy=jstatd.all.policy-j-dcom.sun.management.jmxremote.authenticate=false- j-dcom.sun.management.jmxremote.ssl=false-j-dcom.sun.management.jmxremote.port=8888 &
|
The parameters are described as follows:
- Djava.rmi.server.hostname=xxx.xxx.xxx.xxx host address, I am configuring an extranet address
- Dcom.sun.management.jmxremote.port=xxx port number, after configuring port number, you need to open it to use the command: iptables-a input-p tcp-d Port port number-j ACCEPT
- Dcom.sun.management.jmxremote.authenticate=false whether to turn on authentication, false can not use password access
3. Verifying availability
Use ps -ef|grep -i 8888
to verify that the process exists, and after it exists, you can see that the description is OK when you use it jps <ip>
to see if you can see the virtual machine process for the remote machine.
This through the three, you can see the contents of the remote machine on the client's VisualVm, open the VISUALVM program, in remote right-click New Connection, enter the address of the remote server, such as, click on a connection, Right-click to view a process: monitor the Tomcat process on Linux server two:
VisualVm Plugin Introduction
You can add functionality to VisualVM by installing plug-ins provided by the VisualVM plug-in Manager by using the plug-in organizer. You can also develop your own plugins and add them to the Update center to extend the functionality of the VisualVM.
For example, installing the Visualvm-mbeans plug-in can add a "MBeans" label to the Application tab, which allows you to monitor and manage MBeans within VisualVM.
To install the VisualVM plugin:
- From the main menu, choose Tools > Plugins.
- In the Available Plugins tab, select the Install check box for the plug-in. Click Install.
- Step through the plugin installer.
Introduction to virtual machine performance monitoring and troubleshooting tools