jps & jvmtop

2,758 views

Published on

Slides accompanying a lightning talk I gave at the Altamira Fall 2013 conference.

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,758
On SlideShare
0
From Embeds
0
Number of Embeds
37
Actions
Shares
0
Downloads
17
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

jps & jvmtop

  1. 1. jps & jvmtop Scott Leberknight
  2. 2. "How you monitor your software is as important as its functionality" - Nathan Marz, "Your Code is Wrong"
  3. 3. jps Like ps, but lists Java processes
  4. 4. jps
  5. 5. jps -l (that's a lowercase L)
  6. 6. jps -m
  7. 7. jps -v
  8. 8. jps -lmv (of course you can combine arguments...)
  9. 9. monitor remote host jps foo.bar.com:6666 (a jstatd process must be running on remote host)
  10. 10. beware tmpwatch! jps gets info from /tmp/hsperfdata_<username>/<pid>
  11. 11. beware tmpwatch! (2)
  12. 12. beware tmpwatch! (3) tmpwatch could delete hsperfdata files for long running VMs, e.g. Hadoop NameNode jps won't see JVMs if process file deleted! oops!
  13. 13. jps summary list process id and class name options: -q: suppress class name -l: fully-qualified class name -m: arguments to main() -v: VM arguments -V: VM arguments via flag file
  14. 14. jvmtop Like top, but for Java processes
  15. 15. ./jvmtop.sh
  16. 16. jvmtop columns PID: 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
  17. 17. jvmtop columns (2) CPU: the CPU utilization GC: % of time spent in garbage collection VM: information about the JVM (S6U31 = Sun 6, update 31) USERNAME: process owner #T: number of JVM threads DL: deadlock indicator (shows !D if deadlock detected)
  18. 18. ./jvmtop.sh <pid>
  19. 19. jvmtop detail columns TID: 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
  20. 20. jvmtop profiler ./jvmtop.sh --profile <PID>
  21. 21. References Nathan Marz, "Your Code is Wrong": www.slideshare.net/nathanmarz/your-code-is-wrong http://www.youtube.com/watch?v=QOu4e5y6sg4 jps: docs.oracle.com/javase/7/docs/technotes/tools/share/jps.html jstatd: docs.oracle.com/javase/7/docs/technotes/tools/share/jstatd.html jstack: docs.oracle.com/javase/7/docs/technotes/tools/share/jstack.html jvmtop project: code.google.com/p/jvmtop/
  22. 22. My Info scott.leberknight@altamiracorp.com @gmail.com www.altamiracorp.com/blog www.sleberknight.com/blog twitter: sleberknight

×