With New Relic's real-time profiling for Java using Java Flight Recorder (JFR) metrics, you can run continuous, always-on profiling of your Java code in production environments. The accompanying JVM cluster timeline view provides a fast and intuitive way to diagnose cluster-wide performance problems. For example, you can quickly see how an application’s deployment affects the overall health of the cluster.
Troubleshooting performance bottlenecks in your Java application or service can help you better understand the following:
- Where you’re wasting resources
- When an incident occurs
- What happened during an incident
- What performance issues led up to an incident
To make troubleshooting faster and easier, you need to see the high fidelity runtime characteristics of your code running on the JVM, and you need that data in real time.
The JFR daemon is an exporter for JFR events which allows you to harness the power of the New Relic One platform for visualizing your JVM's behavior. Using the New Relic Java telemetry SDK as the underlying implementation, the JFR daemon converts JFR events into New Relic telemetry types and reports them to New Relic's metric and event ingest APIs.
There are three different usage scenarios for the JFR daemon:
- New Relic Java agent JFR service (RECOMMENDED) - JFR monitoring built into the flagship New Relic Java agent. No additional setup is needed, simply install the Java agent, make sure that the JFR service is enabled, and JFR data will flow into the same APM application as the Java agent. Requires New Relic Java agent version 7.0.0+.
- Standalone process - Run the
jfr-daemonas a standalone process and configure it to monitor an existing Java process using remote JMX.
- Standalone Java agent - Attach the
jfr-daemonto your Java process as a Java agent. A lightweight alternative to the New Relic Java agent.
While the JFR daemon supports any version of Java 11 and above, we don't recommend using any non-LTS version of Java in production environments.
Some vendors have backported JFR to their Java 8 binaries. For instance, OpenJDK backported JFR on version 8u262. The JFR daemon is compatible with those Java versions.
Requirements and instructions vary for each usage scenario. For full details please see the links for your specific usage scenario:
- New Relic Java agent JFR service - Requirements, configuration, and usage instructions
- Standalone process - Requirements, configuration, and usage instructions
- Standalone Java agent - Requirements, configuration, and usage instructions
Apps running with the JFR daemon should expect the JFR subsystem to use additional memory.
To view your data, go to one.newrelic.com > Explorer > (select service) > More Views > Realtime Profiling Java.
The JVM cluster timeline view shows the JVM behavior across your entire cluster. This timeline enables quicker troubleshooting and issue detection; for example, at a glance you can see:
- How a recent deployment affected the rest of the JVM cluster
- When a JVM restarted
- How an individual instance was affected by its noisy neighbor
To make troubleshooting easier, you need to see the high fidelity runtime characteristics of your code running on the JVM, and you need that data in real time.
one.newrelic.com > Explorer > (select service) > Realtime Profiling Java: The JVM cluster timeline view shows the JVM behavior across the cluster.
Each row of the timeline represents a specific JVM over time. Inside each row, a box represents a 5-minute period of that JVM’s life. From least severe to most severe, yellow, orange, and red traffic lights indicate anomalous behavior for a JVM, so you can drill down into that instance and the right time period when investigating errors or other performance issues.
Select How is JVM health determined? for a detailed breakdown of how JVM health is calculated.
The details panel for each JVM provides several critical views:
- How resources are allocated within a process
- How garbage collection affects performance
- How to track garbage collection with logs
- How CPU is used
one.newrelic.com > Explorer > (select service) > Realtime Profiling Java > (select JVM): You can see details for each JVM.
The flamegraph feature is only compatible with the New Relic Java agent JFR service usage scenario.
Use flamegraphs to identify the Java classes and methods that are most frequently executed in your application code. By using flamegraphs to optimize the hot spots in your code you can reduce resource consumption and increase your application’s overall performance.
one.newrelic.com > Explorer > (select service) > Realtime Profiling Java > (select JVM): You can see details for each JVM, including flamegraphs.