OTHER JFR EVENTS
JFR is extensible: applications can define their own events. Hence, your JFR implementation may
show many more available event types depending on the application in question. For example, the
WebLogic application server enables a number of application server events: JDBC operations,
HTTP operations, and so on. These events are treated just like the other JFR events discussed
here: they can be individually enabled, may have some threshold associated with them, and so on.
Similarly, later versions of the JVM may have additional events that are not discussed here.
Consult the up-to-date product documentation for the most detailed information.
Collecting events naturally involves some overhead. The threshold at which events are col-
lected—since it increases the number of events—also plays a role in the overhead that comes
from enabling a JFR recording. In the default recording, not all events are collected (the six
most-expensive events are not enabled), and the threshold for the time-based events is some-
what high. This keeps the overhead of the default recording to less than 1%.
There are times when extra overhead is worthwhile. Looking at TLAB events, for example,
can help you determine if objects are being allocated directly to the old generation, but those
events are not enabled in the default recording. Similarly, the profiling events are enabled in
the default recording, but only every 20 ms—that gives a good overview, but it can also lead
to sampling errors.
The events (and the threshold for events) that JFR captures are defined in a template (which
is selected via the settings option on the command line). JFR ships with two templates: the
default template (limiting events so that the overhead will be less than 1%) and a profile tem-
plate (which sets most threshold-based events to be triggered every 10 ms). The estimated
overhead of the profiling template is 2% (though, as always, your mileage may vary, and I
typically observe a much lower overhead than that).
Templates are managed by the jmc template manager; you may have noticed a button to start
the template manager in Figure 3-13 . Templates are stored in two locations: under the
$HOME/.jmc/<release> directory (local to a user) and in the $JAVA_HOME/jre/lib/jfr dir-
ectory (global for a JVM). The template manager allows you to select a global template (the
template will say that it is “on server”), select a local template, or define a new template. To
define a template, cycle through the available events, and enable (or disable) them as desired,
optionally setting the threshold at which the event kicks in.
Figure 3-14 shows that the File Read event is enabled with a threshold of 15 ms: file reads
that take longer than that will cause an event to be triggered. This event has also been con-