Java VisualVM monitors remote JVM and javavisualvmjvm

Source: Internet
Author: User
Tags visualvm

Java VisualVM monitors remote JVM and javavisualvmjvm

We often need to perform various tests on the software we developed, and the use of the software to system resources is even more indispensable. Currently, there are multiple monitoring tools, compared with JProfiler, which consumes a lot of system resources, especially memory, JDK1.6 comes with VisualVM, which is a good monitoring tool.
This tool is located in jvisualvm.exe under the JAVA_HOME \ bin \ directory. Double-click this file to see a more intuitive interface.

 
The Applications tree on the Left can be used to monitor not only the local JVM running status, but also the JVM running status on a remote machine.
Local monitoring: a JAVA program is automatically added to local monitoring.

Because local monitoring does not need to be configured, this section mainly introduces remote JVM monitoring.
To perform remote monitoring, the local visual VM must communicate with the remote JVM. Currently, visual VM supports two remote connection methods.
Jstatd and JMX Methods: Here I mainly introduce the JMX method.

To connect to a remote machine through JMX, the following configuration is required:
1. Modify the JDK configuration file of the remote machine (I use linux as the remote machine ).
A. Go to the JAVA_HOME \ jre \ lib \ management \ directory.
B. Copy the jmxremote. password. template file to the current directory and change it to jmxremote. password.
C. Open the jmxremote. password File and remove the comments before # monitorRole QED and # controlRole R & D.

2. modify the configuration file of the program to be monitored on the remote machine (I am monitoring the application deployed in the Tomcat container ).
A. Go to the atat_home \ bin directory.
B. Open the catalina. sh file and add the following information:
JAVA_OPTS = "$ JAVA_OPTS-Djava. rmi. server. hostname = 192.168.0.237
-Dcom. sun. management. JMX remote. port = 18999
-Dcom. sun. management. jmxremote. ssl = false
-Dcom. sun. management. jmxremote. authenticate = false"
C. Restart the Tomcat service.

3. Client VisualVM configuration (my client uses WinXP ).
A. Click Remote and select Add Remote Host...
B. Enter the IP address of the Remote machine (192.168.0.237) in the pop-up interface. The IP address will be added to the Remote node.
C. Click the IP address and select Add JMX Connection. On the displayed page, enter the configured port number (18999). The Connection will be added to the IP node.
D. Click the link and select Open.

Now we can see the monitoring interface, from which we can see CPU information, memory information, statistics on the number of loaded classes, thread information.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.