----

Developer Tools

Java Developer Tools: There are lots of tools provided in JDK release, Some of them are listed here.

Standared JDK Tools and Utilities:

  • Basic Tools (appletviewer, apt, extcheck, jar, java, javac, javadoc, javah, javap, jdb)
  • Security Tools (keytool, jarsigner, policytool, kinit, klist, ktab)
  • Internationalization Tools (native2ascii)
  • Remote Method Invocation (RMI) Tools (rmic, rmiregistry, rmid, serialver)
  • Java IDL and RMI-IIOP Tools (tnameserv, idlj, orbd, servertool)
  • Java Deployment Tools (javafxpackager, pack200, unpack200)
  • Java Web Start Tools (javaws)
  • Java Troubleshooting, Profiling, Monitoring and Management Tools (JConsole, Visual VM)
  • Java Web Services Tools (schemagen, wsgen, wsimport, xjc)
Experimental JDK Tools and Utilities: The tools described in below section are unsupported and experimental in nature and should be used with that in mind. They might not be available in future JDK versions.
  • Java Virtual Machine Statistics Monitoring Tools: jstat, jstatd, jps
  • Troubleshooting Tools : jinfo, jhat, jmap, jsadebugd, jstack 
  • Scripting Tools : jrunscript

Request a Thread Dump from the JVM

Java Memory Map (jmap): To take dump of shared object memory map or heap for any running java process the following command can be used.

prompt>jmap -dump:format=b,file=filename.hprof {PID}
where pid is java process id. use ps -ef on linux and task manager on windows to get the PID.

To obtain a thread dump using jstack, run the following command:
prompt>jstack PID

You can output consecutive thread dumps to a file by using the console output redirect/append directive:
prompt>jstack PID >> threaddumps.log

JConsole (jconsole.exe) can also be used to take thread dump form the UI.

Get the PID of your java process
The first piece of information you will need to be able to obtain a thread dump is your java process's PID.

The java JDK ships with the jps command which lists all java process ids. You can run this command like this:
prompt>jps -l

5704 com.intellij.idea.Main
70660 sun.tools.jps.Jps
70305

Use Java Virtual Machine Statistics Monitoring Tool-jstat
The best way to check the GC status of the Web Application Server (WAS) in operation is to use the jstat command.
The following command shows an application JVM GC statics, using this you can get the GC execution time for the given application JVM.

jstat -gcutil PID

prompt> jstat -gcutil 3076
  S0     S1          E      O         P     YGC     YGCT    FGC    FGCT     GCT
  0.00   0.00   1.06  41.54  99.27   2137      8.819  2123  190.822  199.642

Devide YGCT by YGC to get Young generation (minor) GC execution time in miliseconds. Same way devide FGCT by FGC to know Full GC execution time. If GC execution times are less than a minite then GC tuning is not required.

Oracle has released Java 7 update 40, with some major new features in JDK 7 Update 40 (7u40) release. Java Mission Control is bundled with this JDK release a JVM monitoring tool, Rule Sets for Java applets and Web Start applications, and a lots of bug fixes.

Mission Control

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collection framework built into the Oracle JDK. It allows Java administrators and developers to gather detailed low level information about how the Java Virtual Machine (JVM) and the Java application are behaving.

Using the Java SE Advanced and Java SE Suite you can do the following


  • Monitor, manage, and profile Java applications without performance overheads
  • Leverage a “time-machine” for back-in-time root cause analysis and profiling
  • Choose from two leading VMs—HotSpot and JRockit—under a single license
  • Utilize enterprise JRE management features
  • Leverage industry-leading, real-time infrastructure capabilities with JRockit Real Time
The tool suite comprises three major components: The Java Process Browser, JMX Console, and Java Flight Recorder.
The Java Process Browser allows users to list and connect to both locally and remotely running Java applications. It automatically detects locally running Java processes, as well as remote Java processes using the Java Discovery Protocol (JDP).
The JMX Console is used for managing and monitoring the JDK through the JMX interface. It provides information such as the live set, heap usage, CPU load, and other attributes exposed via MBeans and registered with the MBean server.
Java Flight Recorder provides a way to collect events from a Java application from the OS layer, the JVM, and the Java application. Collected events include thread latency events such as sleep, wait, lock contention, I/O, GC, and method profiling. Oracle estimates the performance overhead for running Flight Recorder at around 2% for most applications.
For more details please see the following PDF from Oracle

No comments :

Post a Comment