Tuesday, November 30, 2010

10 things you didn't know about - Java performance monitoring



    JConsole is a built-in Java performance profiler that works from the command-line and in a GUI shell. It's not perfect, but it's an adequate first line of defense






    The most effective response to a performance problem is to use a profiler rather than reviewing the code or JVM garbage collector flags.






    Monitor the class count - if the count steadily rises, then you can assume that either the app server or your code has a ClassLoader leak somewhere and will run out of PermGen space before long.






    com.sun.management.HotSpotDiagnostic has a "dumpHeap" mebean operation that allows a dump to be created (remotely) which can be analysed later.






    jstat can monitor garbage collection and JIT compiler statistics
  • jstack will get a stack dump from any process





  • jmap can produce a dump of the heap, or a histogram of live classes and how many instances there are and the spaced used by them.






    jhat supports analysing heap dumps obtained from jmap or jconsole or HotSpotDiagnostic.dumpHeap






No comments: