1 / 26

Flight Recorder in OpenJDK

Flight Recorder in OpenJDK. Erik Gahlin, Markus Grönlund Java Product Group Hotspot Runtime October 23, 2018. Safe Harbor Statement.

iwhite
Télécharger la présentation

Flight Recorder in OpenJDK

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 • JVM • 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 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 @Category, a hierarchal categorization in the format of a human-readable path. @Label, human-readable name, title cased @Description, a sentence describing the event/field @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 • Continuousconsumption is importantifyouwant to monitor an application, for instanceupdate the chartof the CPU loadonceevery second. • To access JFR data today, a recording must be started, stopped and dumped to a seperatefile • Thisworkswellifyouwant data for a longer period oftime, a minute or more, but not suited for monitoringdue 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: https://bugs.openjdk.java.net/browse/JDK-8184193

  25. How to contribute • Sign up on our mailing list:http://mail.openjdk.java.net/mailman/listinfo/hotspot-jfr-dev • Look for small bugs and enhancements:https://bugs.openjdk.java.net/issues/?jql=Subcomponent%3Djfr • Take a look at the source code:http://hg.openjdk.java.net/jdk/jdk/file/tip/src/jdk.jfr/ http://hg.openjdk.java.net/jdk/jdk/file/tip/src/jdk.management.jfr/ http://hg.openjdk.java.net/jdk/jdk/file/tip/src/hotspot/share/jfr • Discuss changes on the mailing list • Sign the Oracle Contributer Agreement and send out the patch for review

  26. Questions?

More Related