Documentation Contents
Java Platform, Standard Edition Java Flight Recorder Runtime Guide
Contents    Previous    Next

1 Introduction

This chapter serves as an introduction to the Java Flight Recorder. It contains these sections:

1.1 Overview

Have you ever wondered what really happens in a running Java program? Have you ever wanted to "go back in time" and analyze what happened right before a problem occurred in your system? Do you want an extremely detailed level of profiling without impacting performance? Java Flight Recorder has been engineered to meet all of these goals.

Java Flight Recorder (JFR) does all this by being tightly integrated into the core of the JVM itself and by being very conscious of its performance overhead. Java Flight Recorder provides a wealth of information on the inner workings of the JVM as well as on the Java program running in the JVM. You can use this information for profiling and for root cause analysis of problems. Furthermore, Java Flight Recorder can be enabled at all times even in heavily loaded live production environments, because it causes almost no performance overhead.

While capturing details about the JVM, the Java Flight Recorder has also been tightly integrated into Oracle's Fusion Middleware family of products and provides a full stack view of the system. Everything from Java servlets and database execution at a high level to fine-grained information on thread synchronization and garbage collections is available at your fingertips.

Java Flight Recorder is comprised of a recording engine, which sits inside the JVM, and the Java Mission Control client. The engine produces a recording file which can later be analyzed through the client. This document primarily deals with configuration of the first part, the JVM, and only briefly mentions the Java Mission Control GUI (see Chapter 2, "Quick Start Procedures").

1.2 Enabling Java Flight Recorder

To enable Java Flight Recorder for your JVM, use the following start-up options:

-XX:+UnlockCommercialFeatures -XX:+FlightRecorder

For more information about these options, see the Java SE documentation at http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/java.html (Solaris, Linux)
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html (Windows)

1.3 Java Flight Recorder Uses

Java Flight Recorder is primarily used for:

1.4 Understanding Events

The basic principle underlying Java Flight Recorder is that every piece of data it captures is an event. An event is something that happens in the running application and/or the JVM at a specific point in time. Events have a name, a time stamp, and an optional payload. The payload depends on the type of the event; for example:

In addition to name and time stamp, most events also have information on the thread in which it occurred, the stack trace at the time the event was captured, and the duration of the event. All time stamps in Java Flight Recorder have nanosecond precision.

Requestable events are events that the recording engine can poll with a certain frequency. CPU Load Sample is an example for requestable event. You can configure the interval for the recording engine to poll for this event.

By using the information available in an event, the Java Flight Recorder UI can reconstruct in detail what happened during program execution.

1.5 Performance Overhead

Java Flight Recorder is designed to keep its overhead as low as possible. When default settings are used, both internal testing and customer feedback indicate that performance impact is less than one percent. For some applications, it can be significantly lower. However, for short-running applications (which are not the kind of applications running in production environments), relative startup and warmup times can be larger, which might impact the performance by more than one percent.

Java Flight Recorder monitors the running system at an extremely high level of detail. This produces an enormous amount of data that Java Flight Recorder can handle. Java Flight Recorder filters data as early as possible to maintain low overhead. This is done in two different ways:

1.6 Memory and Disk Buffers

Java Flight Recorder does not write events to disk immediately, as they occur. Instead, it stores data in a hierarchy of in-memory buffers and then moves the data to the disk when the buffers are full. Initially, Java Flight Recorder writes the event data to thread-local buffers, eliminating the need to synchronize between threads for every event, which greatly improves throughput. Once a thread-local buffer has been filled, the data is transferred to a global buffer. When this happens, synchronization is necessary between threads but, because different thread-local buffers fill up at different rates, lock contention is rare. Eventually, the global buffer also runs out of space and the content in the buffers is written to disk. Disk write operations are expensive, so you should try and minimize them by carefully selecting the event data you activate for recording. Writing to disk files produces files in a proprietary, binary format that is extremely compact but also efficient for the applications to read and write.

You can configure Java Flight Recorder so that it does not write any data to disk. In this mode, the global buffer acts as a circular buffer and the oldest data is dropped when the buffer is full. This very low-overhead operating mode still collects all the vital data necessary for root-cause problem analysis. Because the most recent data is always available in the global buffer, it can be written to disk on demand whenever operations or surveillance systems detect a problem. However, in this mode, only the last few minutes of data is available, so it only contains the most recent events. If you need to get the full history of operation for a long period of time, use the default mode when events are written to disk regularly.

Contents    Previous    Next

Oracle and/or its affiliates Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.
Contact Us