Java Reference
In-Depth Information
Live GC Analysis
Virtually every monitoring tool reports something about GC activity. jconsole displays live
graphs of the heap usage; jcmd allows GC operations to be performed; jmap can print heap
summaries or information on the permanent generation or create a heap dump; and jstat
produces a lot of different views of what the garbage collector is doing.
See Chapter 5 for examples of how these programs monitor GC activities.
Heap Dump Postprocessing
Heap dumps can be captured from the jvisualvm GUI, or from the command line using
jcmd or jmap . The heap dump is a snapshot of the heap that can be analyzed with various
tools, including jvisualvm and jhat . Heap dump processing is one area where third-party
tools have traditionally been a step ahead of what comes with the JDK, so Chapter 7 uses a
third-party tool—the Eclipse Memory Analyzer Tool—to provide examples of how to post-
process heap dumps.
Profiling Tools
Profilers are the most important tool in a performance analyst's toolbox. There are many pro-
filers available for Java, each with its own advantages and disadvantages. Profiling is one
area where it often makes sense to use different tools—particularly if they are sampling pro-
filers. One sampling profiler may find different problems than another one, even on the same
application.
Almost all Java profiling tools are themselves written in Java and work by “attaching” them-
selves to the application to be profiled—meaning that the profiler opens a socket (or other
communication channel) to the target application. The target application and the profiling
tool then exchange information about the behavior of the target application.
This means you must pay attention to tuning the profiling tool just as you would tune any
other Java application. In particular, if the application being profiled is large, it will transfer
quite a lot of data to the profiling tool, so the profiling tool must have a sufficiently large
heap to handle the data. It is often a good idea to run the profiling tool with a concurrent GC
algorithm as well; ill-timed full GC pauses in the profiling tool can cause the buffers holding
the data to overflow.
Search WWH ::




Custom Search