Using JConsole

Using the jconsole tool
J2SE 5.0 has comprehensive monitoring and management support. Among the tools
included in the JDK download is a Java Management Extensions (JMX)-compliant monitoring
tool called jconsole. The tool uses the built-in JMX instrumentation in the Java Virtual
Machine to provide information on performance and resource consumption of running
applications. Although the tool is included in the JDK download it can also be used to monitor
and manage applications deployed with the Java 2 Platform Standard Edition Runtime
Environment 5.0 (JRE 5.0).
Jconsole can attach to any application that is started with the JMX agent. A system property
defined on the command line enables the JMX agent. Once attached jconsole can be used to
display useful information such as thread usage, memory consumption, and details about
class loading, runtime compilation, and the operating system.




Figure jconsole Summary tab
The Summary tab provides the following information
– Uptime: how long the JVM has been running
– Total compile time: the amount of time spent in runtime compilation
– Process CPU time: the total amount of CPU time consumed by the JVM

Figure jconsole Memory tab
The Memory tab shown in above Figure provides the following information.
– Current heap size: Number of Kbytes currently occupied by the heap
– Committed memory: Total amount of memory allocated for use by the heap
– Maximum heap size: Maximum number of Kbytes occupied by the heap
– Objects pending for finalization: Number of objects pending for finalization
– Garbage collector information: Information on GC, including the garbage collector
names, number of collections performed, and total time spent performing GC
A view of the memory pictured in above Figure shows two events of interest. At
02:20 a garbage collection was triggered from the Jconsole tool. At 02:50 an
OutOfMemoryError was thrown by an application.

Figure jconsole Threads tab

Figure Thread detail

The Threads tab shown in above Figure provides the following information.
– Live threads: Current number of live daemon threads plus non-daemon threads
– Peak: Highest number of live threads since JVM started
– Daemon threads: Current number of live daemon threads
– Total started: Total number of threads started since the JVM started (including
daemon, nondaemon, and terminated)
The Classes tab provides the following information.
– Current classes loaded: Number of classes currently loaded into memory

– Total classes loaded: Total number of classes loaded into memory since the JVM
started, including those subsequently unloaded
– Total classes unloaded: Number of classes unloaded from memory since the JVM
started

Figure jconsole VM tab
The VM tab shown in above Figure provides the following information.
– JVM type and version
– Uptime
– VM command line arguments
– Class, Library, and Boot Class paths
– JIT Compiler
– Operating System information
In addition to monitoring, jconsole can be used to dynamically change several parameters in
the running system. For example, the setting of the -verbose:gc option can be changed so
that garbage collection trace output can be dynamically enabled or disabled for a running
application. You can also perform a GC by clicking the Perform GC button on the Memory
tab.
Getting started with jconsole
1. Start the application with the -Dcom.sun.management.jmxremote option. This option sets
the com.sun.management.jmxremote system property which enabled the JMX agent.
2. Start Jconsole with the jconsole command. Jconsole ships as a binary in the
$JAVA_HOME/bin directory. (JAVA_HOME indicates the home directory of the J2SE
installation. For example, /opt/IBM/WebSphere/AppServer/java/bin)

Figure Jconsole Connect to Agent dialog box
3. When Jconsole starts it shows a window with the list of managed VMs on the machine as
shown in Figure 9-12. The process-id (pid) and command line arguments for each VM are
printed. Select a VM, click Connect, and Jconsole will attach to it.
For more information on the monitoring and management features, and details on how to use
Jconsole, read the following document.
http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html

Comments:

Hi

How do you get jconsole up and running in was.

I added the switch to the generic jvm properties tab and it fails badly on startup.

Moreover IBM duck when googled.

viz :-

http://www-1.ibm.com/support/docview.wss?uid=swg1PK45613

Start of stack trace.

javax.management.JMRuntimeException: Failed to load MBeanServerBuilder class com
.ibm.ws.management.PlatformMBeanServerBuilder: java.lang.ClassNotFoundException:
com.ibm.ws.management.PlatformMBeanServerBuilder
at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServ
erFactory.java:499)
at javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanSer
verFactory.java:530)
at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory
.java:304)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFact
ory.java:219)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFact
ory.java:180)
at sun.management.ManagementFactory.createPlatformMBeanServer(Management
Factory.java:264)
at java.lang.management.ManagementFactory.getPlatformMBeanServer(Managem
entFactory.java:512)
at sun.management.jmxremote.ConnectorBootstrap.startLocalConnectorServer
(ConnectorBootstrap.java:385)

Posted by Martyn Ayshford on April 10, 2008 at 10:27 PM PDT #

I now have it up and working. I found a link which suggested.

Doing this

a) On the admin console, add the following line into the field of Generic JVM Argument (note that the first system property is equal to nothing and no equal sign for the second system property):

-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote

b) Add or uncomment the following three lines in file /opt/IBM/WebSphere/AppServer/java/jre/lib/management/management.properties
(or <Your Websphere JRE>/ lib/management/management.properties):

com.sun.management.jmxremote.port=9999
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.ssl=false

Is this how you got it running?

Posted by Martyn Ayshford on April 10, 2008 at 10:57 PM PDT #

Thanks Martyn !
It went to editor for publication in a book and they took out the 2 lines you mentioned in your second post.

Posted by Dileep on April 11, 2008 at 10:16 AM PDT #

Hi,

We were using JConsole to profile our application.
We noticed that in the CLASSES tab, the total number of classes and the current number of classes were same and were steadily increasing.

My question is should the classes be unloaded after the request is handled ?

An earlier reply would be great.

Thank you and have a great day...

Regards,
Vijay M.

Posted by Vijay on December 10, 2008 at 04:33 PM PST #

Hi Dilip,
Can you focus on more, where I will get this part:

a) On the admin console, add the following line into the field of Generic JVM Argument (note that the first system property is equal to nothing and no equal sign for the second system property):

-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote

Deepak

Posted by Deepak kumar on December 14, 2009 at 07:40 PM PST #

You can log in to admin console:
http://hostname:9060/admin
Then go to server and select "WebSphere Application Server".
Then follow this:
Application servers > server1 > Process definition > Java Virtual Machine

You will see a "Generic JVM arguments" label and also will have a text box following that. That is the place to have this entry.
Or else I would go to server.xml and in genericJvmArguments="" entry I would add this.

Posted by Dileep Kumar on January 06, 2010 at 04:49 AM PST #

Vijay M.

Classes won't get unloaded unless a classgc takes place. But after running it for sometime you may have finally all the classes loaded. If you have -Xnoclassgc then classes won't be garbage collected even if they are not needed.

Posted by Dileep Kumar on January 06, 2010 at 04:54 AM PST #

I was trying to use IBM's jconsole application to monitor some custom MBeans developed inhouse which are used to instrument (view and update) some application specific configuration data maintained in an Oracle DB. Our application(s) are hosted in a WebSphere Process Server 6.1 environment. I somehow do not see those MBeans in the MBeans tab of jconsole. What additional setup is requried to enable this? I am able to invoke the custom MBeans just fine using the wsadmin command line utility. We are just looking at jconsole from the perspective of provding a barebones UI to view and change the data using the custom MBeans.

Any help in this regard is greatly appreciated.

Thanks
Venky

Posted by Venky Ramachandran on July 27, 2010 at 02:04 AM PDT #

I started Jconsole well and well to connect to a distant machine but the problem it is that certain function is inactive as the parameters memorials, the thread, the units of execution, the classes java and the general presentation
Although I have parameters well the parameters generic to the server's level, the management.proprieties files and the classPath

Posted by gueddidi on October 20, 2010 at 11:58 PM PDT #

I started Jconsole well and well to connect to a distant machine but the problem it is that certain function is inactive as the parameters memorials, the thread, the units of execution, the classes java and the general presentation
Although I have parameters well the parameters generic to the server's level, the management.proprieties files and the classPath

Posted by gueddidi on October 21, 2010 at 12:10 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

dkumar

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today