jps & jvmtop
DESCRIPTION
Slides accompanying a lightning talk I gave at the Altamira Fall 2013 conference.TRANSCRIPT
Scott Leberknight
jps & jvmtop
"How you monitor your software is as important as its functionality"
- Nathan Marz, "Your Code is Wrong"
jps
Like ps, but lists Java processes
jps
jps -l(that's a lowercase L)
jps -m
jps -v
jps -lmv(of course you can combine arguments...)
monitor remote host
jps foo.bar.com:6666
(a jstatd process must be running on remote host)
beware tmpwatch!jps gets info from /tmp/hsperfdata_<username>/<pid>
beware tmpwatch! (2)
beware tmpwatch! (3)
jps won't see JVMs if process file deleted!
tmpwatch could delete hsperfdata files for long running VMs, e.g. Hadoop NameNode
oops!
jps summary
-l: fully-qualified class name
-m: arguments to main()
list process id and class name
options:
-v: VM arguments
-q: suppress class name
-V: VM arguments via flag file
jvmtop
Like top, but for Java processes
./jvmtop.sh
jvmtop columnsPID: process id
MAIN-CLASS: "jvm name"; class with main() method
HPCUR: currently used heap memory
HPMAX: maximum heap memory used
NHCUR: current non-heap memory used (e.g. PermGen)
NHMAX: maximum non-heap memory JVM can allocate
jvmtop columns (2)
USERNAME: process owner
#T: number of JVM threads
DL: deadlock indicator (shows !D if deadlock detected)
CPU: the CPU utilization
GC: % of time spent in garbage collection
VM: information about the JVM (S6U31 = Sun 6, update 31)
./jvmtop.sh <pid>
jvmtop detail columnsTID: thread id
NAME: thread name
STATE: thread state
CPU: the CPU utilization (relative to all processors)
TOTALCPU: CPU utilization since thread started
BLOCKEDBY: thread that is blocking a thread
jvmtop profiler
./jvmtop.sh --profile <PID>
References
jps:docs.oracle.com/javase/7/docs/technotes/tools/share/jps.html
jvmtop project:code.google.com/p/jvmtop/
Nathan Marz, "Your Code is Wrong":www.slideshare.net/nathanmarz/your-code-is-wronghttp://www.youtube.com/watch?v=QOu4e5y6sg4
jstack:docs.oracle.com/javase/7/docs/technotes/tools/share/jstack.html
jstatd:docs.oracle.com/javase/7/docs/technotes/tools/share/jstatd.html
My Info
twitter: sleberknight
www.sleberknight.com/blog
[email protected] @gmail.com
www.altamiracorp.com/blog