Collect Java heaps under load

I am running a load on Tomcat 6 running on Java 6. I want to collect a bunch of Java heaps when the Tomcat server is under load. I usually use jmap -dump to collect my heaps.

However, when I try to do this when Tomcat handles a high load, I found that the heapdump assembly failed.

Is jmap the best tool for collecting heap dump from a process under load? What are the possible reasons that jmap will not be able to compile heapdump?

If jmap is not the best tool - which is better?

It is quite acceptable for me for jmap (or some other tool) to stop the world in the Java process, while a heap dump is done.

+5
source share
3 answers

, Tomcat JMX visualvm. , jmap .

+2

jmap ?

: , . :

. JDK.

+2

, jmap . :

  • . , .
  • -F
  • -XX: + HeapDumpOnOutOfMemoryError , OOM.
  • Launch Tomcat interactively and add a bunch of heaps on the ctrl-break option. This gives you a stream dump, something you'll probably need anyway
  • If your heap size is especially large and you have a recurring state, temporarily reduce the heap size. This simplifies the processing of the resulting file, takes less time and is likely to succeed.
+2
source

All Articles