Java Reference
In-Depth Information
Java Flight Recorder
The key feature of Java Mission Control is the Java Flight Recorder (JFR). As its name sug-
gests, JFR data is a history of events in the JVM that can be used to diagnose the past per-
formance and operations of the JVM.
The basic operation of JFR is that some set of events are enabled (for example, one event is
that a thread is blocked waiting for a lock). Each time a selected event occurs, data about that
event is saved (either in memory or to a file). The data stream is held in a circular buffer, so
only the most recent events are available. Java Mission Control can then display those
events—either taken from a live JVM or read from a saved file—and you can perform ana-
lysis on those events to diagnose performance issues.
All of that—the kind of events, the size of the circular buffer, where it is stored, and so
on—is controlled via various arguments to the JVM, via the Java Mission Control GUI, and
by jcmd commands as the program runs. By default, JFR is set up so that it has very low
overhead: an impact below 1% of the program's performance. That overhead will change as
more events are enabled, or as the threshold at which events are reported is changed, and so
on. The details of all that configuration are discussed later in this section, but first we'll ex-
amine what the display of these events look like, since that makes it easier to understand how
JFR works.
JFR overview
This example uses a JFR recording taken from a GlassFish application server over a
6-minute period. The server is running the stock servlet discussed in Chapter 2 . As the re-
cording is loaded into Java Mission Control, the first thing it displays is a basic monitoring
overview ( Figure 3-9 ).
Search WWH ::

Custom Search