jps & jvmtop
-
Upload
scott-leberknight -
Category
Technology
-
view
1.472 -
download
7
description
Transcript of jps & jvmtop
![Page 1: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/1.jpg)
Scott Leberknight
jps & jvmtop
![Page 2: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/2.jpg)
"How you monitor your software is as important as its functionality"
- Nathan Marz, "Your Code is Wrong"
![Page 3: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/3.jpg)
jps
Like ps, but lists Java processes
![Page 4: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/4.jpg)
jps
![Page 5: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/5.jpg)
jps -l(that's a lowercase L)
![Page 6: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/6.jpg)
jps -m
![Page 7: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/7.jpg)
jps -v
![Page 8: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/8.jpg)
jps -lmv(of course you can combine arguments...)
![Page 9: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/9.jpg)
monitor remote host
jps foo.bar.com:6666
(a jstatd process must be running on remote host)
![Page 10: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/10.jpg)
beware tmpwatch!jps gets info from /tmp/hsperfdata_<username>/<pid>
![Page 11: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/11.jpg)
beware tmpwatch! (2)
![Page 12: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/12.jpg)
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!
![Page 13: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/13.jpg)
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
![Page 14: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/14.jpg)
jvmtop
Like top, but for Java processes
![Page 15: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/15.jpg)
./jvmtop.sh
![Page 16: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/16.jpg)
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
![Page 17: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/17.jpg)
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)
![Page 18: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/18.jpg)
./jvmtop.sh <pid>
![Page 19: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/19.jpg)
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
![Page 20: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/20.jpg)
jvmtop profiler
./jvmtop.sh --profile <PID>
![Page 21: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/21.jpg)
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
![Page 22: jps & jvmtop](https://reader035.fdocuments.net/reader035/viewer/2022081718/54833ef45906b5a8158b467a/html5/thumbnails/22.jpg)
My Info
twitter: sleberknight
www.sleberknight.com/blog
[email protected] @gmail.com
www.altamiracorp.com/blog