SlideShare a Scribd company logo
Miroslav Wengner
Profiling
with Java Flight Recorder
Safe Harbour Statement
All what you will hear can be di
ff
erent, this presentation is for
motivational purposes …
Miroslav Wengner
• Husband, Father, Software Engineer, Technology Enthusiast
• JCP: Executive Committee Board Member
• OpenJDK Committer , Java Mission Control Project, Open-Source
• Co-Author of Robo4J Project (Duke Award)
• Java Champion, JavaOne RockStar, Blogger
• Principal Engineer at OpenValue
• Group Of Talented and Motivated Individuals
• Netherlands, Germany, Switzerland, Austria…
• Fun, Development, Trainings, Migration and
more…
Application
Crash
No Relevant
Information
Adding a
Logging
Performance
Penalties
Removing
Logging
Agenda
• History in nutshell
• JMC and Flight Recorder in bullet points
• JFR under the hood
• JFR in Action and Examples
• Power of Data Visualisation
• What about JDK improvements and upcoming features?
• Q/A
History in nutshell
• 1998 Appeal Virtual Machines (AVM) - JRockit JVM
• 2002 AVM acquired by BEA
• 2008 acquired by Oracle
• 2012 JDK 7u4 update: Oracle integrated JFR into the HotSpot
• 2017 JDK 9 : Public APIs for creating and consuming data
• 2018 JDK 11: JMC/JFR announced to be fully Open-Sourced
JFR in bullets
• Part of Java Mission Control project
• Java Flight Recorder is an event based tracing framework
• Build directly into the Java Virtual Machine
• Provides access to all internal events
• Allows to create custom events
• Tries to achieve a goal 1% overhead
JFR meets Java Platform
• Compiled to byte-code
• Usage of JIT Compiler
• Byte code optimisation
• module, package: jdk.jfr
Profiling with JFR
• Observability allows to measure a system based on provided data metrics
(local, on-prem or cloud)
• each application may have di
ff
erent telemetry, di
ff
erent assumptions
• hardware, container, end-points, libraries….
• Monitoring -> keeping yes on sampled data
• Pro
fi
ling -> recording and analysing “real” data
https://www.hippopx.com/en/camera-security-monitoring-big-brother-control-surveillance-camera-video-surveillance-81117
Common Usage of JFR
• Micros-Services, Distributes and Stand-Alone applications
• helps in root-cause analysis
• application understanding, bottlenecks
• solution correctes
• testing
• monitoring
Let’s split
More Pods there…
Java Mission Control Project
Current release 8.3
Release Milestone Date
========== =========== ==========
8.2.0 GA 2022-01-19
8.2.1 GA 2022-06-16
8.3 EA 2022-10-11
8.1 : New Allocation Events for JDK 16,
• JMC Agent, JMC Agent Plugin
• Performance Improvements : Perser, Rules
8.2: Minor release
• JFR: Heat-Map View, WebSocket-API
8.3: Minor release
• JMC Core: Parser improvements
• JFR: Dependency view, Graph Pruning, JFR: Selectable attributes,
• Agent: bug
fi
xing
Java Mission Control Project
Current release 8.3
Dependency View
Graph pruning View
Flameview Selectable Attributes
Java Flight Recorder
under the hood
Java Event API
JVM Events
Thread Local
Buffers
Events
Global Bu
ff
ers
Repository
per 1s
JFR Event Streaming (JEP 349): Continual Monitoring
JFR under the hood: Event - fundamental element
• Import “jdk.jfr.Event”
• Basic Element that caries valuable information
EventID:
Timestamp : when event was taken
Duration: not always
Thread ID: Thread where event has occurred
StackTrace ID: It’s optional referst to the StackTrace, default depth 64
Payload: custom information
Import jdk.jfr.Event;
public class SampleEvent extends Event {
//internal logic
String message;
}
…
void someAdvanceLogic() {
SampleEvent e = new SampleEvent();
e.message = “Important Information”;
e.begin();
// advanced logic
e.end();
e.commit();
}
…
JFR under the hood: Event
JFR under the hood: : Tuning up an Event
Annotations: https://docs.oracle.com/en/java/javase/19/docs/api/jdk.jfr/jdk/jfr/class-use/MetadataDe
fi
nition.html
Annotation Description Default
@Name
Automatically Set, Recommended pattern: org.com…
Event
Full path with Name:
openvalue.SampleEvent
@Label Short descriptive information
@Category Category is present to the user
@Threshold
Default min duration fo the event to be included in the
recording
0ns
@StackTrace Include a stack-trace to the event TRUE
@Enabled Is Event enabled by default con
fi
guration
JFR under the hood: : Tuning up an Event
import jdk.jfr.Event
import jdk.jfr.Label
import jdk.jdf.Name
@Name(“com.openvalue.events.SampleEvent”)
@Label(“Sample Event”)
class SampleEvent extends Event {
@Label(“Message”)
String name;
@Label(“Value”)
int value;
}
Annotations: https://docs.oracle.com/en/java/javase/19/docs/api/jdk.jfr/jdk/jfr/class-use/MetadataDe
fi
nition.html
JFR under the hood: Performance
• Usage of Thread Local Bu
ff
ers
• Java Platform Optimisation
• Methods: INLINING, CODE ELIMINATION, SCALARIZATION
• What happens when event is enabled / disabled
-XX:StartFlightRecording=filename=<RECORDING_FILE>.jfr,dumponexit=true,settings=profile
void someAdvanceLogic() {
SampleEvent e = new SampleEvent();
e.message = “Important Information”;
e.begin();
// advanced logic
e.commit();
}
void commit() {
// IF it’s not enabled -> NOT INTERESTING
if(isEnabled()){
//now() reads CPU clock register, cheap check
long duration = now() - startTime;
if(duration > THRESHOLD) {
if (shouldCommit()) {
// Cheap - Thread local writes
actuallyCommit();
}
}
}
Mikeal Vidstedt presented quite neat pseudo-code that helps to understand to the commit()
JFR under the hood: Event in Action
void someAdvanceLogic(){
// allocating event
SampleEvent e = new SampleEvent();
e.begin(); -> INLINING => e.startTime = now(); -> e.startTime = <JVM intrinsic>
// advanced logic
// timestamp, likewise INLINING, implicit end()
e.commit();
// JFR ENABLED STATE
if(e.isEnabled()){
// perform additional checks and maybe actuallyCommit()
}
}
JFR under the hood: Enabled
JFR under the hood: Disabled - part 1
void someAdvanceLogic() {
SampleEvent e = new SampleEvent();
// INLINING from the previous slide
e.startTime = <JVM intrinsic>;
// advanced logic
//INLINING
if(false) { // result e.isEnabled()
//perform additional checks
//CODE ELIMINATION -> will be removed
}
}
JFR under the hood: Disabled - part 2
void someAdvanceLogic() {
SampleEvent e = new SampleEvent(); // SCALARIZATION -> REMOVAL
e.begin()
1. initial state: e.begin();
2. INLINING => e.startTime = <JVM intrinsic>;
3. INLINING => long startTime = <JVM intrisic>;
4. CODE ELIMINATION => long startTime = <JVM intrisic>; REMOVAL
//business logic
}
JFR under the hood: Disabled - part 3
void someAdvanceLogic() {
//business logic
}
JFR: Start Recording
# Starting a recording
$ java -XX:StartFlightRecording …
# Starting Recording and Storing into the file
$ java -XX:StartFlightRecording=filename=<FILE_NAME>.jfr
# Starting Recording and dump on exit
$ java -XX:StartFlightRecording=filename=<FILE_NAME>.jfr,dumponexit-true,settings=profile
# Using jcmd command via PID to start recording
$ jcmd <PID> JFR.start duration=30s filename=hotmethods_jcmd.jfr
JFR: Data Visualisation
• Command line tool avaliable from JDK 11 => jfr
$jfr summary <JFR_file>
$jfr print —json <JFR_FILE>
• JFR GUI. (DEMO)
• Automated analysis
• Java Application => Thread, Memory, etc.
• Event Browser
DEMO: Hot-Methods
DEMO: Garbage-Collection
DEMO: Latency
DEMO: Java Platform Module Latency
var threadPerTaskExecutor = Executors.newThreadPerTaskExecutor(threadFactory);
var executor = Executors.newVirtualThreadPerTaskExecutor();
threadPerTaskExecutor.execute(() -> {
while (active.get()){
executor.submit(new ComputableTask(counter));
}
})
•
JFR: How to Get
• Clone: https://github.com/openjdk/jmc. => script build.sh
• AdoptOpenJDK: http://adoptopenjdk.net/jmc
• Azul: https://www.azul.com/products/zulu-mission-control
• RedHat: distributes as RPMs in Fedora and RHEL
• Oracle: https://www.oracle.com/java/technologies/jdk-mission-control.html
JMC-JVM-LANG Tutorial: https://github.com/mirage22/jmc-jvm-lang-tutorial
JFR-Tutorial: https://github.com/thegreystone/jmc-tutorial
Q / A
Thank YOU !
twitter: @miragemiko
gitlab:@mirage22
DEMOS: https://github.com/mirage22/jmc-jvm-lang-tutorial
References:
• Project Amber: https://openjdk.org/projects/amber/
• Project Loom: https://openjdk.org/projects/loom/
• JFR Project: https://github.com/openjdk/jmc
• OpenJDK: https://openjdk.org/
• JEP-349 JFR Event Steaming: https://openjdk.org/jeps/349
• foojay.io: https://foojay.io/today/author/miro-wengner/
• OpenValue Blog: https://openvalue.blog/
Book In Progress: Practical Design Patterns for Java Developers [PACKT]

More Related Content

What's hot

RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
Mr. Vengineer
 
LLVM Register Allocation (2nd Version)
LLVM Register Allocation (2nd Version)LLVM Register Allocation (2nd Version)
LLVM Register Allocation (2nd Version)
Wang Hsiangkai
 
Tiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVMTiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVM
Igor Veresov
 
Verilator勉強会 2021/05/29
Verilator勉強会 2021/05/29Verilator勉強会 2021/05/29
Verilator勉強会 2021/05/29
ryuz88
 
OpenFOAM の Function Object 機能について
OpenFOAM の Function Object 機能についてOpenFOAM の Function Object 機能について
OpenFOAM の Function Object 機能について
Fumiya Nozaki
 
ACRi HLSチャレンジ 高速化テクニック紹介
ACRi HLSチャレンジ 高速化テクニック紹介ACRi HLSチャレンジ 高速化テクニック紹介
ACRi HLSチャレンジ 高速化テクニック紹介
Jun Ando
 
FPGA-Based Acceleration Architecture for Spark SQL Qi Xie and Quanfu Wang
FPGA-Based Acceleration Architecture for Spark SQL Qi Xie and Quanfu Wang FPGA-Based Acceleration Architecture for Spark SQL Qi Xie and Quanfu Wang
FPGA-Based Acceleration Architecture for Spark SQL Qi Xie and Quanfu Wang
Spark Summit
 
Lecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxLecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptx
king779879
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
Brendan Gregg
 
About chtMultiRegionFoam
About chtMultiRegionFoam About chtMultiRegionFoam
About chtMultiRegionFoam
守淑 田村
 
ELFの動的リンク
ELFの動的リンクELFの動的リンク
ELFの動的リンク
7shi
 
Apache Spark's Built-in File Sources in Depth
Apache Spark's Built-in File Sources in DepthApache Spark's Built-in File Sources in Depth
Apache Spark's Built-in File Sources in Depth
Databricks
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with Octave
Amiq Consulting
 
Is 12 Factor App Right About Logging
Is 12 Factor App Right About LoggingIs 12 Factor App Right About Logging
Is 12 Factor App Right About Logging
Phil Wilkins
 
あるキャッシュメモリの話
あるキャッシュメモリの話あるキャッシュメモリの話
あるキャッシュメモリの話
nullnilaki
 
Linux : The Common Mailbox Framework
Linux : The Common Mailbox FrameworkLinux : The Common Mailbox Framework
Linux : The Common Mailbox Framework
Mr. Vengineer
 
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...Michael Lee
 
Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old Secrets
Brendan Gregg
 
規格書で読むC++11のスレッド
規格書で読むC++11のスレッド規格書で読むC++11のスレッド
規格書で読むC++11のスレッド
Kohsuke Yuasa
 

What's hot (20)

RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
 
VPNaaS in Neutron
VPNaaS in NeutronVPNaaS in Neutron
VPNaaS in Neutron
 
LLVM Register Allocation (2nd Version)
LLVM Register Allocation (2nd Version)LLVM Register Allocation (2nd Version)
LLVM Register Allocation (2nd Version)
 
Tiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVMTiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVM
 
Verilator勉強会 2021/05/29
Verilator勉強会 2021/05/29Verilator勉強会 2021/05/29
Verilator勉強会 2021/05/29
 
OpenFOAM の Function Object 機能について
OpenFOAM の Function Object 機能についてOpenFOAM の Function Object 機能について
OpenFOAM の Function Object 機能について
 
ACRi HLSチャレンジ 高速化テクニック紹介
ACRi HLSチャレンジ 高速化テクニック紹介ACRi HLSチャレンジ 高速化テクニック紹介
ACRi HLSチャレンジ 高速化テクニック紹介
 
FPGA-Based Acceleration Architecture for Spark SQL Qi Xie and Quanfu Wang
FPGA-Based Acceleration Architecture for Spark SQL Qi Xie and Quanfu Wang FPGA-Based Acceleration Architecture for Spark SQL Qi Xie and Quanfu Wang
FPGA-Based Acceleration Architecture for Spark SQL Qi Xie and Quanfu Wang
 
Lecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxLecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptx
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
 
About chtMultiRegionFoam
About chtMultiRegionFoam About chtMultiRegionFoam
About chtMultiRegionFoam
 
ELFの動的リンク
ELFの動的リンクELFの動的リンク
ELFの動的リンク
 
Apache Spark's Built-in File Sources in Depth
Apache Spark's Built-in File Sources in DepthApache Spark's Built-in File Sources in Depth
Apache Spark's Built-in File Sources in Depth
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with Octave
 
Is 12 Factor App Right About Logging
Is 12 Factor App Right About LoggingIs 12 Factor App Right About Logging
Is 12 Factor App Right About Logging
 
あるキャッシュメモリの話
あるキャッシュメモリの話あるキャッシュメモリの話
あるキャッシュメモリの話
 
Linux : The Common Mailbox Framework
Linux : The Common Mailbox FrameworkLinux : The Common Mailbox Framework
Linux : The Common Mailbox Framework
 
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
 
Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old Secrets
 
規格書で読むC++11のスレッド
規格書で読むC++11のスレッド規格書で読むC++11のスレッド
規格書で読むC++11のスレッド
 

Similar to DevDays: Profiling With Java Flight Recorder

ASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdfASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdf
Miro Wengner
 
JMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezialJMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezial
Miro Wengner
 
Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.
Alexandre (Shura) Iline
 
Troubleshooting Tools In JDK
Troubleshooting Tools In JDKTroubleshooting Tools In JDK
Troubleshooting Tools In JDK
Poonam Bajaj Parhar
 
Java mission control and java flight recorder
Java mission control and java flight recorderJava mission control and java flight recorder
Java mission control and java flight recorder
Wolfgang Weigend
 
Monitoring Java Application Security with JDK Tools and JFR Events.pdf
Monitoring Java Application Security with JDK Tools and JFR Events.pdfMonitoring Java Application Security with JDK Tools and JFR Events.pdf
Monitoring Java Application Security with JDK Tools and JFR Events.pdf
Ana-Maria Mihalceanu
 
Performance Monitoring with Java Flight Recorder on OpenJDK [DEV2406]
Performance Monitoring with Java Flight Recorder on OpenJDK [DEV2406]Performance Monitoring with Java Flight Recorder on OpenJDK [DEV2406]
Performance Monitoring with Java Flight Recorder on OpenJDK [DEV2406]
Hiroaki NAKADA
 
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...Jeffrey West
 
Java Colombo Meetup: Java Mission Control & Java Flight Recorder
Java Colombo Meetup: Java Mission Control & Java Flight RecorderJava Colombo Meetup: Java Mission Control & Java Flight Recorder
Java Colombo Meetup: Java Mission Control & Java Flight Recorder
Isuru Perera
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
mattjive
 
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at RuntimeOSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
NETWAYS
 
Jdk Tools For Performance Diagnostics
Jdk Tools For Performance DiagnosticsJdk Tools For Performance Diagnostics
Jdk Tools For Performance Diagnostics
Dror Bereznitsky
 
Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40
Roger Brinkley
 
A Glance At The Java Performance Toolbox.pdf
 A Glance At The Java Performance Toolbox.pdf A Glance At The Java Performance Toolbox.pdf
A Glance At The Java Performance Toolbox.pdf
Ana-Maria Mihalceanu
 
A Glance At The Java Performance Toolbox.pdf
 A Glance At The Java Performance Toolbox.pdf A Glance At The Java Performance Toolbox.pdf
A Glance At The Java Performance Toolbox.pdf
Ana-Maria Mihalceanu
 
Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...
IndicThreads
 
Java Flight Recorder Behind the Scenes
Java Flight Recorder Behind the ScenesJava Flight Recorder Behind the Scenes
Java Flight Recorder Behind the Scenes
Staffan Larsen
 
A Glance At The Java Performance Toolbox
 A Glance At The Java Performance Toolbox A Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
Ana-Maria Mihalceanu
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Similar to DevDays: Profiling With Java Flight Recorder (20)

ASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdfASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdf
 
JMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezialJMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezial
 
Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.
 
Troubleshooting Tools In JDK
Troubleshooting Tools In JDKTroubleshooting Tools In JDK
Troubleshooting Tools In JDK
 
Java mission control and java flight recorder
Java mission control and java flight recorderJava mission control and java flight recorder
Java mission control and java flight recorder
 
Monitoring Java Application Security with JDK Tools and JFR Events.pdf
Monitoring Java Application Security with JDK Tools and JFR Events.pdfMonitoring Java Application Security with JDK Tools and JFR Events.pdf
Monitoring Java Application Security with JDK Tools and JFR Events.pdf
 
Performance Monitoring with Java Flight Recorder on OpenJDK [DEV2406]
Performance Monitoring with Java Flight Recorder on OpenJDK [DEV2406]Performance Monitoring with Java Flight Recorder on OpenJDK [DEV2406]
Performance Monitoring with Java Flight Recorder on OpenJDK [DEV2406]
 
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
WebLogic Developer Webcast 5: Troubleshooting and Testing with WebLogic, Soap...
 
Java Colombo Meetup: Java Mission Control & Java Flight Recorder
Java Colombo Meetup: Java Mission Control & Java Flight RecorderJava Colombo Meetup: Java Mission Control & Java Flight Recorder
Java Colombo Meetup: Java Mission Control & Java Flight Recorder
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
 
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at RuntimeOSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
OSMC 2021 | inspectIT Ocelot: Dynamic OpenTelemetry Instrumentation at Runtime
 
Jdk Tools For Performance Diagnostics
Jdk Tools For Performance DiagnosticsJdk Tools For Performance Diagnostics
Jdk Tools For Performance Diagnostics
 
Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40Java Mission Control in Java SE 7U40
Java Mission Control in Java SE 7U40
 
A Glance At The Java Performance Toolbox.pdf
 A Glance At The Java Performance Toolbox.pdf A Glance At The Java Performance Toolbox.pdf
A Glance At The Java Performance Toolbox.pdf
 
A Glance At The Java Performance Toolbox.pdf
 A Glance At The Java Performance Toolbox.pdf A Glance At The Java Performance Toolbox.pdf
A Glance At The Java Performance Toolbox.pdf
 
Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...
 
Profiling documentforaltrec
Profiling documentforaltrecProfiling documentforaltrec
Profiling documentforaltrec
 
Java Flight Recorder Behind the Scenes
Java Flight Recorder Behind the ScenesJava Flight Recorder Behind the Scenes
Java Flight Recorder Behind the Scenes
 
A Glance At The Java Performance Toolbox
 A Glance At The Java Performance Toolbox A Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

More from Miro Wengner

Boost delivery stream with code discipline engineering
Boost delivery stream with code discipline engineeringBoost delivery stream with code discipline engineering
Boost delivery stream with code discipline engineering
Miro Wengner
 
[meetup] Mastering Java enhancements like a Pro: practical design patterns an...
[meetup] Mastering Java enhancements like a Pro: practical design patterns an...[meetup] Mastering Java enhancements like a Pro: practical design patterns an...
[meetup] Mastering Java enhancements like a Pro: practical design patterns an...
Miro Wengner
 
New Java features: Simplified Design Patterns[LIT3826]
New Java features: Simplified Design Patterns[LIT3826]New Java features: Simplified Design Patterns[LIT3826]
New Java features: Simplified Design Patterns[LIT3826]
Miro Wengner
 
Plug Hardware and Play Java
Plug Hardware and Play JavaPlug Hardware and Play Java
Plug Hardware and Play Java
Miro Wengner
 
From Concept to Robotic Overlord with Robo4J
From Concept to Robotic Overlord with Robo4J From Concept to Robotic Overlord with Robo4J
From Concept to Robotic Overlord with Robo4J
Miro Wengner
 
JavaOne 2016 :: Bringing Robot online with Robo4j Framework
JavaOne 2016 :: Bringing Robot online with Robo4j FrameworkJavaOne 2016 :: Bringing Robot online with Robo4j Framework
JavaOne 2016 :: Bringing Robot online with Robo4j Framework
Miro Wengner
 
JavaOne presentation - building steps :: Number42 is alive
JavaOne presentation - building steps :: Number42 is alive JavaOne presentation - building steps :: Number42 is alive
JavaOne presentation - building steps :: Number42 is alive
Miro Wengner
 
The Robot under dictate of the LegoMindStorm Java Concurrency API
The Robot under dictate of the LegoMindStorm Java Concurrency APIThe Robot under dictate of the LegoMindStorm Java Concurrency API
The Robot under dictate of the LegoMindStorm Java Concurrency API
Miro Wengner
 
How RaspberryPi workers building GraphDatabase
How RaspberryPi workers building GraphDatabaseHow RaspberryPi workers building GraphDatabase
How RaspberryPi workers building GraphDatabase
Miro Wengner
 

More from Miro Wengner (9)

Boost delivery stream with code discipline engineering
Boost delivery stream with code discipline engineeringBoost delivery stream with code discipline engineering
Boost delivery stream with code discipline engineering
 
[meetup] Mastering Java enhancements like a Pro: practical design patterns an...
[meetup] Mastering Java enhancements like a Pro: practical design patterns an...[meetup] Mastering Java enhancements like a Pro: practical design patterns an...
[meetup] Mastering Java enhancements like a Pro: practical design patterns an...
 
New Java features: Simplified Design Patterns[LIT3826]
New Java features: Simplified Design Patterns[LIT3826]New Java features: Simplified Design Patterns[LIT3826]
New Java features: Simplified Design Patterns[LIT3826]
 
Plug Hardware and Play Java
Plug Hardware and Play JavaPlug Hardware and Play Java
Plug Hardware and Play Java
 
From Concept to Robotic Overlord with Robo4J
From Concept to Robotic Overlord with Robo4J From Concept to Robotic Overlord with Robo4J
From Concept to Robotic Overlord with Robo4J
 
JavaOne 2016 :: Bringing Robot online with Robo4j Framework
JavaOne 2016 :: Bringing Robot online with Robo4j FrameworkJavaOne 2016 :: Bringing Robot online with Robo4j Framework
JavaOne 2016 :: Bringing Robot online with Robo4j Framework
 
JavaOne presentation - building steps :: Number42 is alive
JavaOne presentation - building steps :: Number42 is alive JavaOne presentation - building steps :: Number42 is alive
JavaOne presentation - building steps :: Number42 is alive
 
The Robot under dictate of the LegoMindStorm Java Concurrency API
The Robot under dictate of the LegoMindStorm Java Concurrency APIThe Robot under dictate of the LegoMindStorm Java Concurrency API
The Robot under dictate of the LegoMindStorm Java Concurrency API
 
How RaspberryPi workers building GraphDatabase
How RaspberryPi workers building GraphDatabaseHow RaspberryPi workers building GraphDatabase
How RaspberryPi workers building GraphDatabase
 

Recently uploaded

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 

Recently uploaded (20)

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 

DevDays: Profiling With Java Flight Recorder

  • 2. Safe Harbour Statement All what you will hear can be di ff erent, this presentation is for motivational purposes …
  • 3. Miroslav Wengner • Husband, Father, Software Engineer, Technology Enthusiast • JCP: Executive Committee Board Member • OpenJDK Committer , Java Mission Control Project, Open-Source • Co-Author of Robo4J Project (Duke Award) • Java Champion, JavaOne RockStar, Blogger • Principal Engineer at OpenValue
  • 4. • Group Of Talented and Motivated Individuals • Netherlands, Germany, Switzerland, Austria… • Fun, Development, Trainings, Migration and more…
  • 6. Agenda • History in nutshell • JMC and Flight Recorder in bullet points • JFR under the hood • JFR in Action and Examples • Power of Data Visualisation • What about JDK improvements and upcoming features? • Q/A
  • 7. History in nutshell • 1998 Appeal Virtual Machines (AVM) - JRockit JVM • 2002 AVM acquired by BEA • 2008 acquired by Oracle • 2012 JDK 7u4 update: Oracle integrated JFR into the HotSpot • 2017 JDK 9 : Public APIs for creating and consuming data • 2018 JDK 11: JMC/JFR announced to be fully Open-Sourced
  • 8. JFR in bullets • Part of Java Mission Control project • Java Flight Recorder is an event based tracing framework • Build directly into the Java Virtual Machine • Provides access to all internal events • Allows to create custom events • Tries to achieve a goal 1% overhead
  • 9. JFR meets Java Platform • Compiled to byte-code • Usage of JIT Compiler • Byte code optimisation • module, package: jdk.jfr
  • 10. Profiling with JFR • Observability allows to measure a system based on provided data metrics (local, on-prem or cloud) • each application may have di ff erent telemetry, di ff erent assumptions • hardware, container, end-points, libraries…. • Monitoring -> keeping yes on sampled data • Pro fi ling -> recording and analysing “real” data https://www.hippopx.com/en/camera-security-monitoring-big-brother-control-surveillance-camera-video-surveillance-81117
  • 11. Common Usage of JFR • Micros-Services, Distributes and Stand-Alone applications • helps in root-cause analysis • application understanding, bottlenecks • solution correctes • testing • monitoring Let’s split More Pods there…
  • 12. Java Mission Control Project Current release 8.3 Release Milestone Date ========== =========== ========== 8.2.0 GA 2022-01-19 8.2.1 GA 2022-06-16 8.3 EA 2022-10-11 8.1 : New Allocation Events for JDK 16, • JMC Agent, JMC Agent Plugin • Performance Improvements : Perser, Rules 8.2: Minor release • JFR: Heat-Map View, WebSocket-API 8.3: Minor release • JMC Core: Parser improvements • JFR: Dependency view, Graph Pruning, JFR: Selectable attributes, • Agent: bug fi xing
  • 13. Java Mission Control Project Current release 8.3 Dependency View Graph pruning View Flameview Selectable Attributes
  • 14. Java Flight Recorder under the hood Java Event API JVM Events Thread Local Buffers Events Global Bu ff ers Repository per 1s JFR Event Streaming (JEP 349): Continual Monitoring
  • 15. JFR under the hood: Event - fundamental element • Import “jdk.jfr.Event” • Basic Element that caries valuable information EventID: Timestamp : when event was taken Duration: not always Thread ID: Thread where event has occurred StackTrace ID: It’s optional referst to the StackTrace, default depth 64 Payload: custom information
  • 16. Import jdk.jfr.Event; public class SampleEvent extends Event { //internal logic String message; } … void someAdvanceLogic() { SampleEvent e = new SampleEvent(); e.message = “Important Information”; e.begin(); // advanced logic e.end(); e.commit(); } … JFR under the hood: Event
  • 17. JFR under the hood: : Tuning up an Event Annotations: https://docs.oracle.com/en/java/javase/19/docs/api/jdk.jfr/jdk/jfr/class-use/MetadataDe fi nition.html Annotation Description Default @Name Automatically Set, Recommended pattern: org.com… Event Full path with Name: openvalue.SampleEvent @Label Short descriptive information @Category Category is present to the user @Threshold Default min duration fo the event to be included in the recording 0ns @StackTrace Include a stack-trace to the event TRUE @Enabled Is Event enabled by default con fi guration
  • 18. JFR under the hood: : Tuning up an Event import jdk.jfr.Event import jdk.jfr.Label import jdk.jdf.Name @Name(“com.openvalue.events.SampleEvent”) @Label(“Sample Event”) class SampleEvent extends Event { @Label(“Message”) String name; @Label(“Value”) int value; } Annotations: https://docs.oracle.com/en/java/javase/19/docs/api/jdk.jfr/jdk/jfr/class-use/MetadataDe fi nition.html
  • 19. JFR under the hood: Performance • Usage of Thread Local Bu ff ers • Java Platform Optimisation • Methods: INLINING, CODE ELIMINATION, SCALARIZATION • What happens when event is enabled / disabled -XX:StartFlightRecording=filename=<RECORDING_FILE>.jfr,dumponexit=true,settings=profile
  • 20. void someAdvanceLogic() { SampleEvent e = new SampleEvent(); e.message = “Important Information”; e.begin(); // advanced logic e.commit(); } void commit() { // IF it’s not enabled -> NOT INTERESTING if(isEnabled()){ //now() reads CPU clock register, cheap check long duration = now() - startTime; if(duration > THRESHOLD) { if (shouldCommit()) { // Cheap - Thread local writes actuallyCommit(); } } } Mikeal Vidstedt presented quite neat pseudo-code that helps to understand to the commit() JFR under the hood: Event in Action
  • 21. void someAdvanceLogic(){ // allocating event SampleEvent e = new SampleEvent(); e.begin(); -> INLINING => e.startTime = now(); -> e.startTime = <JVM intrinsic> // advanced logic // timestamp, likewise INLINING, implicit end() e.commit(); // JFR ENABLED STATE if(e.isEnabled()){ // perform additional checks and maybe actuallyCommit() } } JFR under the hood: Enabled
  • 22. JFR under the hood: Disabled - part 1 void someAdvanceLogic() { SampleEvent e = new SampleEvent(); // INLINING from the previous slide e.startTime = <JVM intrinsic>; // advanced logic //INLINING if(false) { // result e.isEnabled() //perform additional checks //CODE ELIMINATION -> will be removed } }
  • 23. JFR under the hood: Disabled - part 2 void someAdvanceLogic() { SampleEvent e = new SampleEvent(); // SCALARIZATION -> REMOVAL e.begin() 1. initial state: e.begin(); 2. INLINING => e.startTime = <JVM intrinsic>; 3. INLINING => long startTime = <JVM intrisic>; 4. CODE ELIMINATION => long startTime = <JVM intrisic>; REMOVAL //business logic }
  • 24. JFR under the hood: Disabled - part 3 void someAdvanceLogic() { //business logic }
  • 25. JFR: Start Recording # Starting a recording $ java -XX:StartFlightRecording … # Starting Recording and Storing into the file $ java -XX:StartFlightRecording=filename=<FILE_NAME>.jfr # Starting Recording and dump on exit $ java -XX:StartFlightRecording=filename=<FILE_NAME>.jfr,dumponexit-true,settings=profile # Using jcmd command via PID to start recording $ jcmd <PID> JFR.start duration=30s filename=hotmethods_jcmd.jfr
  • 26. JFR: Data Visualisation • Command line tool avaliable from JDK 11 => jfr $jfr summary <JFR_file> $jfr print —json <JFR_FILE> • JFR GUI. (DEMO) • Automated analysis • Java Application => Thread, Memory, etc. • Event Browser
  • 30. DEMO: Java Platform Module Latency var threadPerTaskExecutor = Executors.newThreadPerTaskExecutor(threadFactory); var executor = Executors.newVirtualThreadPerTaskExecutor(); threadPerTaskExecutor.execute(() -> { while (active.get()){ executor.submit(new ComputableTask(counter)); } }) •
  • 31. JFR: How to Get • Clone: https://github.com/openjdk/jmc. => script build.sh • AdoptOpenJDK: http://adoptopenjdk.net/jmc • Azul: https://www.azul.com/products/zulu-mission-control • RedHat: distributes as RPMs in Fedora and RHEL • Oracle: https://www.oracle.com/java/technologies/jdk-mission-control.html JMC-JVM-LANG Tutorial: https://github.com/mirage22/jmc-jvm-lang-tutorial JFR-Tutorial: https://github.com/thegreystone/jmc-tutorial
  • 32. Q / A Thank YOU ! twitter: @miragemiko gitlab:@mirage22 DEMOS: https://github.com/mirage22/jmc-jvm-lang-tutorial
  • 33. References: • Project Amber: https://openjdk.org/projects/amber/ • Project Loom: https://openjdk.org/projects/loom/ • JFR Project: https://github.com/openjdk/jmc • OpenJDK: https://openjdk.org/ • JEP-349 JFR Event Steaming: https://openjdk.org/jeps/349 • foojay.io: https://foojay.io/today/author/miro-wengner/ • OpenValue Blog: https://openvalue.blog/ Book In Progress: Practical Design Patterns for Java Developers [PACKT]