"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 -l (that's a lowercase L)
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) tmpwatch could delete hsperfdata files for long running VMs, e.g. Hadoop NameNode jps won't see JVMs if process file deleted! oops!
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
jvmtop Like top, but for Java processes
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
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)
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