Java Tuning


Tags:

To trace a java thread from a thread dump to the corresponding thread on Solaris 10, you can find the LWP using pstack by converting the NID (which corresponds to the LWP ID on Solaris) and matching it up in the pstack output, or by finding the TID listed in the pstack output.

For example, I ran a thread dump and I want to trace this thread from the dump:

"ExecuteThread: '2' for queue: 'weblogic.kernel.System'" daemon prio=5 tid=0x00880588 nid=0x35 in Object.wait() [aba7f000..aba7fc30]
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:429)

Tags:

To enable verbose GC output use the follwing java options when starting the JVM:

-verbose:gc

The output looks like this (and can vary slightly from different version of the JVM):

 
[GC 46336K->3775K(129664K), 0.2158256 secs]

This line represents a partial GC, as can been seen by the first part of the line:

[GC

if this GC had been a full GC, the first part of the output would be:

[Full GC

The other fields are as follows:


Tags:

To enable remote JMX for Java for the SUN JVM, add these options to your JAVA_OPTIONS settings:

-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false"

This will allow you to connect to the JVM with such tools as JConsole.