Presentation is loading. Please wait.

Presentation is loading. Please wait.

Flight Recorder in OpenJDK

Similar presentations


Presentation on theme: "Flight Recorder in OpenJDK"— Presentation transcript:

1 Flight Recorder in OpenJDK
Erik Gahlin, Markus Grönlund Java Product Group Hotspot Runtime October 23, 2018

2 Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation.

3 What is Flight Recorder (JFR)?
A system for recording events, analogous to the device in an aircraft. An event is a piece of data at a specific instant of time. Very low overhead, suitable for production environments. Execution history saved for the time period leading up to a problem. A useful tool for discovering latencies. Built-in events for JVM, JDK and OS. APIs for producing and consuming events. Frequently used by JVM engineers. Proven technology in JRockit and the Hotspot VM for almost 10 years.

4 Events in the JVM and JDK
Garbage Collection Configuration, Pause times, Heap usage, Allocation requiring GC, Evacuations, Metaspace, Young Collection, Old Collection, G1, ZGC, Parallel... Runtime Safepoints, Class Loading, Threads, VM Operations, Biased Locking, Monitor inflation, Modules Compiler Compilations, Inlining Configuration System Properties, Command-line flags, Version string

5 Events in the JVM and JDK
Java Application Exceptions and Errors Allocations Old Object (memory leaks) Thread Start, Thread End, Thread Park Socket I/O File I/O Monitor Wait, Monitor Blocked Operating System Environment Variables, Native Libraries, CPU Load and Context Switches, Network Utilization, Physical Memory, System Processes

6 Use cases Correctness Performance and scalability Troubleshooting
We can add tests that use information in events to verify correctness. Performance and scalability Monitor and verify that correctness is completed within acceptable time intervals. Troubleshooting Investigate the execution and latency history persisted for time periods leading up to a problem. Save round-trips for data gathering and attach directly to bug report to get analysis underway faster. Understand real data in production environments Monitor patterns of real data, such as customer inputs.

7 OpenJDK – free and open source
A commercial offering for many years. Contributed by Oracle to OpenJDK and open sourced in JDK 11. Free to use. Just as free to use as any GC or compiler in the VM. JDK Mission Control tool also open sourced in JDK 11.

8 Demo

9 How to describe your own events
@Label, human-readable name, title cased @Description, a sentence describing the event/field @Category, a hierarchal categorization in the format of a human-readable path. @Name, identifying name, similar to fully qualified class name

10 Content Types

11 Duration event

12 Periodic event Useful for extracting the state of a system.
Examples: CPU-load, command-line parameters, GC configuration

13 Configuration

14 Configuration File (.jfc)
<configuration> <event name="com.company.product.HelloWorld"> <setting name="enabled">true</setting> <setting name="stackTrace">true</setting> <setting name="threshold">1 ms</setting> <setting name="period">1 s</setting> </event> </configuration> $> java -XX:StartFlightRecording:settings=my.jfc ... $> java -XX:StartFlightRecording:settings=default.jfc,my.jfc ...

15 Reading recording files
Classes for reading recorded data. For example, RecordedEvent, RecordedObject, RecordedStackTrace, RecordedThread, RecordedMethod, RecordedClass Getters for extracting values from an event. For example, RecordedEvent::getDuration, RecordedEvent::getThread, RecordedEvent::getStackTrace

16 Some event practices

17 # {method} ‘fibonacci(I)I’
# Intel x86 syntax # -XX:LoopUnrollLimit=0

18 Definition

19 Deployment

20 Disabling

21 What about overhead?

22 # {method} 'getFibonacci(I)I'
# Intel x86 syntax # -XX:LoopUnrollLimit=0

23 fibonacci(I)I getFibonacci(I)I

24 Future: Event Streaming
Continuous consumption is important if you want to monitor an application, for instance update the chart of the CPU load once every second. To access JFR data today, a recording must be started, stopped and dumped to a seperate file This works well if you want data for a longer period of time, a minute or more, but not suited for monitoring due to overhead created by each new recording The intent is to provide users with an API so they can read directly from the disk repository as data is being recorded JEP draft:

25 How to contribute Sign up on our mailing list: Look for small bugs and enhancements: Take a look at the source code: Discuss changes on the mailing list Sign the Oracle Contributer Agreement and send out the patch for review

26 Questions?


Download ppt "Flight Recorder in OpenJDK"

Similar presentations


Ads by Google