Jconsole Use Example Commentary

Source: Internet
Author: User
Tags jconsole

The Jconsole is a set of Java Virtual Machine Execution health monitors that can be used to monitor virtual machine memory, threads, CPU usage, and associated Mbean related to Java processes, such as the following:


Figure 1

How to connect a monitored Java Virtual machine:

1. Set the parameters of the monitored Java Virtual Machine boot, in general, there will be the following three parameters, respectively:

-dcom.sun.management.jmxremote.port=1090

-dcom.sun.management.jmxremote.ssl=false

-dcom.sun.management.jmxremote.authenticate=false

In eclipse, for example, as seen in:


Figure 2

After the monitored virtual machine is started, we can connect the Jconsole on other computers remotely.

The process of connecting is as follows:

1. Open cmd and enter Jconsole, and the Jconsole console will appear, for example, as seen below:


Figure 3

We then enter the IP address and port number of the Java Virtual machine to be monitored, and if the input is correct, the connection button will take effect if the designed monitoring port number is 12345, the IP of the connection is: 10.72.35.130, for example, as seen:


Figure 4

After clicking on the connection, you will go to Figure 1 and the connection will be successful.

In the Overview tab, the main monitoring is the heap memory, thread, class, and CPU utilization of the virtual machine;

In Memory tab, can choose to monitor the memory objects, heap memory, non-heap memory, PS Eden Space, PS Survivor space, PS old Gen, Code Cache, PS Per Gen of course, here is monitoring the parallel scovage algorithm Virtual, assuming that the collector is the other algorithm, may show the name will be different, but essentially the same, this interested in the ability to try.

Like threading lab, Class Lab, VM Overview Lab here is not too much to introduce, the following emphasis on the "Mbean" label

The Mbeans of the platform or application of the JMX agent can be obtained through the Mbeans tag. For example, the Mbeans of memory is defined as follows:

Public interface Memorymxbean {public        memoryusage getheapmemoryusage ();      Public Memoryusage getnonheapmemoryusage ();       public int getobjectpendingfinalizationcount ();       public boolean     isverbose ();       public void        Setverbose (boolean value);      public void        GC ();  
A memory Mbean contains four properties:

Heapmemoryusage. A read-only attribute used to describe the current heap memory usage

Nonheapmemoryusage. A read-only property describing the usage of the current non-heap memory

Objectpendingfinalizationcount. Describes how many objects are suspended for recycling.

Verbose. To dynamically set whether the GC follows specific stack information, an Mbean for a Boolean variable memory supports an operation--GC that can send a real-time garbage collection request

The tree structure on the left side of the MBean label shows a list of all Mbeans by name. The name of an Mbean object consists of a domain name and a string of keyword attributes. For example, the Mbeans of the JVM's platform is a group under the "Java.lang" domain, while the mbeans of the log is under the "java.util.logging" domain. The name of the Mbean object is defined in the Javax.management.ObjectName specification.
When you select an Mbean, attribute, action, or notification in the tree, some information will be displayed to the right. Suppose the property is writable (the property is marked blue) and you can set it.


The MBean operation allows you to manipulate the actions listed in the Actions node.


Mbean notifies you that you can also see notifications sent by Mbean: By default, if you do not subscribe to notifications, Jconsole will not receive a notification that an mbean has occurred. You can click on the "Subscribe" button to define the heap notifications, and use the "last subscription" button to unsubscribe 4, the Monitor Memory Memory tab page to get statistics on memory consumption, memory pool, garbage collection by reading the memory system, memory pool, garbage collected Mbean.

Jconsole Use Example Commentary

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.