So basically in our case the server goes down mysteriously and we often restart it and it starts to work fine. Till now we haven't been able to establish a pattern. Looking at thread dump did help but we want to analyse memory usage too. Can these tools be set up to run at regular intervals (so they keep saving snapshots at regular intervals) or whenever it detects an exception or crash
Can I set up profiles like jhat or jmap to take snapshots at regular intervals or whenever exception is detected
208 views Asked by Smiles in a Jar At
2
There are 2 answers
0
On
run jmap in a cron?
Another option is to attach jdb to the process. It will stop on uncaught exception and you can take a heap dump using jmap in that state. Unfortunately jdb itself doesn't support taking a heap dump.
It won't produce a complete dump, but
jstat
can be run continuously to provide sumamry statistics of memory over time at regular intervals:for instance, will produce memory pool and garbage collection statistics every minute until you kill it with
Ctrl-C
.jstat
can do a lot more than memory and garbage collection. See the jstat manpage for more information:http://docs.oracle.com/javase/6/docs/technotes/tools/share/jstat.html