Pages

Tuesday, July 12, 2011

JVM -Xtrace the holy grail of WebSphere Application Server tracing

Today's objective is to generate -Xtrace for ALL methods on the WebSphere PMI interfaces that our PMI modules implement. These PMI interfaces are called by the WAS container to compute PMI statistics. To do this we use IBM JVM's method trace facility.

Method trace is a powerful tool for tracing methods in any Java code. Method trace provides a comprehensive and detailed diagnosis of code paths inside your application, and also inside the system classes. You do not have to add any hooks or calls to existing code. You can focus on interesting code by using wild cards and filtering to control method trace. Method trace can trace method entry, exit and parameters.

Use method trace to debug and trace application code and the system classes provided with the JVM.
While method trace is powerful, it also has a cost. Application throughput is affected by method trace. The impact is proportion to the number of methods traced. Additionally, trace output is reasonably large and might require a large amount of drive space. For instance, a full method trace of a "Hello World" application is over 10 MB
You can control method trace by using the command-line option -Xtrace:. This -Xtrace is set as a JVM generic argument in the WebSphere Application Server admin console.

Please see below for the JVM generic argument for capturing all PMI Event points as JVM trace.
-Xtrace:methods={com/ibm/ws/pmi/server/modules/*.*()},print=mt

This will put the output in native_stderr.log.
You can then write post processors to process the trace or alternately you may be able to suck the output in IBM Health Center to visualize it. I have not tried this yet.

More details on -Xtrace here
http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/topic/com.ibm.java.doc.diagnostics.50/diag/tools/trace_options_method.html
http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.50%2Fdiag%2Ftools%2Ftrace_options_output.html

Unfortunately this will generate the JVM trace for ALL methods of the PMI modules not just the ones on the PMI interface. This limitation we will need to live with for now.Thanks to WAS SWAT Team guru Kevin Grigorenko for sounding me out as we discussed options.


Happy Debugging!


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.