Thursday, September 4, 2014

JVM Command: JInfo

In linux, typically ‘top’ is used to view the details of running processes. Often it is required that you may want to see full process command instead of just the process name. Using option ‘c’ in top, you can see the full command almost always.
However,  typically OS has limits the length of full command  4096 characters! So if your process has longer full command, specaially applicable for java processes; you wouldn’t see it. Neither in ‘top’ nor in ‘ps –ef | grep <pid>’.

Good way to see exact details of the java process is to use ‘jinfo’. Following is the example of such a long command.

<JAVA_HOME>/bin/jinfo <process-id>

Example:
[root@home ~]$ /usr/java/jdk1.6.0_45/bin/jinfo 55761
Attaching to process ID 55761, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 20.45-b01
Java System Properties:

java.runtime.name = Java(TM) SE Runtime Environment
sun.boot.library.path = /usr/java/jdk1.6.0_45/jre/lib/amd64
java.vm.version = 20.45-b01
java.vm.vendor = Sun Microsystems Inc.
java.vendor.url = http://java.sun.com/
storm.home = /opt/storm-0.8.2
path.separator = :
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg = sun.io
sun.java.launcher = SUN_STANDARD
user.country = US
sun.os.patch.level = unknown
java.vm.specification.name = Java Virtual Machine Specification
user.dir = /home/gse
java.runtime.version = 1.6.0_45-b06
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.endorsed.dirs = /usr/java/jdk1.6.0_45/jre/lib/endorsed
os.arch = amd64
java.io.tmpdir = /tmp
line.separator =

java.vm.specification.vendor = Sun Microsystems Inc.
os.name = Linux
log4j.configuration = storm.log.properties
sun.jnu.encoding = UTF-8
java.library.path = /usr/local/lib:/opt/local/lib:/usr/lib
java.specification.name = Java Platform API Specification
java.class.version = 50.0
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
os.version = 2.6.32-358.11.1.el6.x86_64
user.home = /root
user.timezone = GMT
java.awt.printerjob = sun.print.PSPrinterJob
file.encoding = UTF-8
java.specification.version = 1.6
java.class.path = /opt/storm-0.8.2/storm-0.8.2.jar:/opt/storm-0.8.2/lib/jgrapht-0.8.3.jar:/opt/storm-0.8.2/lib/log4j-1.2.16.jar:/opt/storm-0.8.2/lib/kryo-2.17.jar:/opt/storm-0.8.2/lib/guava-13.0.jar:/opt/storm-0.8.2/lib/disruptor-2.10.1.jar:/opt/storm-0.8.2/lib/objenesis-1.2.jar:/opt/storm-0.8.2/lib/junit-3.8.1.jar:/opt/storm-0.8.2/lib/joda-time-2.0.jar:/opt/storm-0.8.2/lib/commons-exec-1.1.jar:/opt/storm-0.8.2/lib/tools.logging-0.2.3.jar:/opt/storm-0.8.2/lib/curator-client-1.0.1.jar:/opt/storm-0.8.2/lib/zookeeper-3.3.3.jar:/opt/storm-0.8.2/lib/ring-core-1.1.5.jar:/opt/storm-0.8.2/lib/commons-fileupload-1.2.1.jar:/opt/storm-0.8.2/lib/tools.macro-0.1.0.jar:/opt/storm-0.8.2/lib/carbonite-1.5.0.jar:/opt/storm-0.8.2/lib/core.incubator-0.1.0.jar:/opt/storm-0.8.2/lib/commons-codec-1.4.jar:/opt/storm-0.8.2/lib/ring-jetty-adapter-0.3.11.jar:/opt/storm-0.8.2/lib/minlog-1.2.jar:/opt/storm-0.8.2/lib/clojure-1.4.0.jar:/opt/storm-0.8.2/lib/clj-time-0.4.1.jar:/opt/storm-0.8.2/lib/commons-logging-1.1.1.jar:/opt/storm-0.8.2/lib/libthrift7-0.7.0.jar:/opt/storm-0.8.2/lib/clout-1.0.1.jar:/opt/storm-0.8.2/lib/jline-0.9.94.jar:/opt/storm-0.8.2/lib/slf4j-log4j12-1.5.8.jar:/opt/storm-0.8.2/lib/jzmq-2.1.0.jar:/opt/storm-0.8.2/lib/servlet-api-2.5.jar:/opt/storm-0.8.2/lib/commons-io-1.4.jar:/opt/storm-0.8.2/lib/httpcore-4.1.jar:/opt/storm-0.8.2/lib/jetty-util-6.1.26.jar:/opt/storm-0.8.2/lib/httpclient-4.1.1.jar:/opt/storm-0.8.2/lib/commons-lang-2.5.jar:/opt/storm-0.8.2/lib/math.numeric-tower-0.0.1.jar:/opt/storm-0.8.2/lib/snakeyaml-1.9.jar:/opt/storm-0.8.2/lib/json-simple-1.1.jar:/opt/storm-0.8.2/lib/compojure-1.1.3.jar:/opt/storm-0.8.2/lib/servlet-api-2.5-20081211.jar:/opt/storm-0.8.2/lib/hiccup-0.3.6.jar:/opt/storm-0.8.2/lib/jetty-6.1.26.jar:/opt/storm-0.8.2/lib/curator-framework-1.0.1.jar:/opt/storm-0.8.2/lib/ring-servlet-0.3.11.jar:/opt/storm-0.8.2/lib/asm-4.0.jar:/opt/storm-0.8.2/lib/reflectasm-1.07-shaded.jar:/opt/storm-0.8.2/lib/tools.cli-0.2.2.jar:/opt/storm-0.8.2/lib/slf4j-api-1.5.8.jar:/opt/storm-0.8.2/log4j:/opt/storm-0.8.2/conf
user.name = root
java.vm.specification.version = 1.0
sun.java.command = backtype.storm.daemon.worker xyz56-36-1406612749 d39a4666-52a2-4099-8ca5-ee9aac670783 6702 d6db40f4-032b-443b-9c7e-b0ddc6b80b31
java.home = /usr/java/jdk1.6.0_45/jre
sun.arch.data.model = 64
user.language = en
java.specification.vendor = Sun Microsystems Inc.
java.vm.info = mixed mode
java.version = 1.6.0_45
java.ext.dirs = /usr/java/jdk1.6.0_45/jre/lib/ext:/usr/java/packages/lib/ext
logfile.name = worker-6702.log
sun.boot.class.path = /usr/java/jdk1.6.0_45/jre/lib/resources.jar:/usr/java/jdk1.6.0_45/jre/lib/rt.jar:/usr/java/jdk1.6.0_45/jre/lib/sunrsasign.jar:/usr/java/jdk1.6.0_45/jre/lib/jsse.jar:/usr/java/jdk1.6.0_45/jre/lib/jce.jar:/usr/java/jdk1.6.0_45/jre/lib/charsets.jar:/usr/java/jdk1.6.0_45/jre/lib/modules/jdk.boot.jar:/usr/java/jdk1.6.0_45/jre/classes
java.vendor = Sun Microsystems Inc.
file.separator = /
java.vendor.url.bug = http://java.sun.com/cgi-bin/bugreport.cgi
sun.io.unicode.encoding = UnicodeLittle
sun.cpu.endian = little
sun.cpu.isalist =

VM Flags:

-Xmx768m -Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib -Dlogfile.name=worker-6702.log -Dstorm.home=/opt/storm-0.8.2 -Dlog4j.configuration=storm.log.properties

Usage:
    jinfo [option] <pid>
        (to connect to running process)
    jinfo [option] <executable <core>
        (to connect to a core file)
    jinfo [option] [server_id@]<remote server IP or hostname>
        (to connect to remote debug server)

where <option> is one of:
    -flag <name>         to print the value of the named VM flag
    -flag [+|-]<name>    to enable or disable the named VM flag
    -flag <name>=<value> to set the named VM flag to the given value
    -flags               to print VM flags
    -sysprops            to print Java system properties
    <no option>          to print both of the above
    -h | -help           to print this help message
 

No comments:

Post a Comment