SlideShare a Scribd company logo
1 of 27
Download to read offline
Miroslav Wengner
JMC/JFR: Kotlin spezial
Pro
fi
ling/Monitoring with joy
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

• OpenJDK Committer , Java Mission Control Project

• Co-Author of Robo4J Project (Duke Award) 

• Contributor to other open-source projects

• Java Champion, JavaOne RockStar
Application
Crash
No Relevant
Information
Adding a
Logging
Performance


Penalties
Removing


Logging
Agenda
• Brief history

• JFR in bullet points

• JFR fundamentals / Under the hood

• Performance (why overhead 1%)

• DEMOS : Java “vs.” Kotlin

• HotMethods, GC, Latencies and more…
• Q/A
Brief history : back in time
• 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
• 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 Under the Hood
Event life cycle
Java Event API
JVM Events
Thread Local


Buffers
Events
Global Bu
ff
ers
Repository
per 1s
JFR Event Streaming (JEP 349): Continual Monitoring
JFR: 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();

}

…
Event: Tuning up
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/16/docs/api/jdk.jfr/jdk/jfr/class-use/MetadataDe
fi
nition.html
…

import jdk.jfr.Categor
y

import jdk.jfr.Descriptio
n

import jdk.jfr.Even
t

import jdk.jfr.Labe
l

….
@Label("Latency-Worker-SampleKotlinEvent"
)

@Category("Latency_Example"
)

@Description("something is done"
)

class SampleKotlinEvent() : Event(
)

…
Event: Tuning up Kotlin way
JFR: Performance
• Usage of Thread Local Bu
ff
ers

• Java Platform Optimization

• Methods: INLINING, CODE ELIMINATION, SCALARIZATION

• What happens when event is enabled / disabled
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()
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: Enabled
JFR: 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: 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 intrisince>;
4. CODE ELIMINATION => long startTime = <JVM intrisince>; REMOVAL

	 

//business logic

	 

}
JFR: Disabled - part 3
void someAdvanceLogic() {

	 //business logic

}
JFR: Data Visualistion
• 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
Java Mission Control Project
Current release 8.1
• New Allocation Events for JDK 16

• JMC Agent, JMC Agent Plugin 

• Performance Improvements : Perser, Rules

• Many others
Release Milestone Date
========== =========== ==========
8.1.0 GA 2021-08-02
8.2.0 RDS 2021-11-24
8.2.0 RDS 2 2021-12-22
8.2.0 GA 2022-01-19
DEMOS: Agenda
• Pro
fi
ling equivalent solution in Java “vs.” Kotlin

• examples: 

• Hot-Methods (SHOW TIME)
• Garbage Collection (SHOW TIME)

• Latency (SHOW TIME)

• JMC Agent + JMC Agent Plugin
https://developers.redhat.com/blog/2020/10/29/collect-jdk-
fl
ight-recorder-events-at-runtime-with-jmc-agent#introduction_to_the_jmc_agent_plugin
DEMO: Hot-Methods
DEMO: Garbage-Collection
DEMO: Latency
DEMO: Latency - Agent
• JMC-Agent v.1.0.0 for Java 11
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

More Related Content

What's hot

Java Mission Control: Java Flight Recorder Deep Dive
Java Mission Control: Java Flight Recorder Deep DiveJava Mission Control: Java Flight Recorder Deep Dive
Java Mission Control: Java Flight Recorder Deep DiveMarcus Hirt
 
Using Flame Graphs
Using Flame GraphsUsing Flame Graphs
Using Flame GraphsIsuru Perera
 
Using Java Flight Recorder
Using Java Flight RecorderUsing Java Flight Recorder
Using Java Flight RecorderMarcus Hirt
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsIsuru Perera
 
Java Performance & Profiling
Java Performance & ProfilingJava Performance & Profiling
Java Performance & ProfilingIsuru Perera
 
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 7U40Roger Brinkley
 
Java Performance and Profiling
Java Performance and ProfilingJava Performance and Profiling
Java Performance and ProfilingWSO2
 
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkSpring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkRed Hat Developers
 
Introduction to GraalVM
Introduction to GraalVMIntroduction to GraalVM
Introduction to GraalVMSHASHI KUMAR
 
Intrinsic Methods in HotSpot VM
Intrinsic Methods in HotSpot VMIntrinsic Methods in HotSpot VM
Intrinsic Methods in HotSpot VMKris Mok
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunningguest1f2740
 
Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Dinakar Guniguntala
 
JVM and Garbage Collection Tuning
JVM and Garbage Collection TuningJVM and Garbage Collection Tuning
JVM and Garbage Collection TuningKai Koenig
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvmPrem Kuppumani
 
Introduction to Real Time Java
Introduction to Real Time JavaIntroduction to Real Time Java
Introduction to Real Time JavaDeniz Oguz
 
Java Performance Monitoring & Tuning
Java Performance Monitoring & TuningJava Performance Monitoring & Tuning
Java Performance Monitoring & TuningMuhammed Shakir
 

What's hot (19)

Java Mission Control: Java Flight Recorder Deep Dive
Java Mission Control: Java Flight Recorder Deep DiveJava Mission Control: Java Flight Recorder Deep Dive
Java Mission Control: Java Flight Recorder Deep Dive
 
Using Flame Graphs
Using Flame GraphsUsing Flame Graphs
Using Flame Graphs
 
Using Java Flight Recorder
Using Java Flight RecorderUsing Java Flight Recorder
Using Java Flight Recorder
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and FlamegraphsSoftware Profiling: Java Performance, Profiling and Flamegraphs
Software Profiling: Java Performance, Profiling and Flamegraphs
 
Java Performance & Profiling
Java Performance & ProfilingJava Performance & Profiling
Java Performance & Profiling
 
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
 
Java Performance and Profiling
Java Performance and ProfilingJava Performance and Profiling
Java Performance and Profiling
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance Tuning
 
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech TalkSpring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
 
Introduction to GraalVM
Introduction to GraalVMIntroduction to GraalVM
Introduction to GraalVM
 
Intrinsic Methods in HotSpot VM
Intrinsic Methods in HotSpot VMIntrinsic Methods in HotSpot VM
Intrinsic Methods in HotSpot VM
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !Java and Containers - Make it Awesome !
Java and Containers - Make it Awesome !
 
JVM and Garbage Collection Tuning
JVM and Garbage Collection TuningJVM and Garbage Collection Tuning
JVM and Garbage Collection Tuning
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance Tuning
 
Performance tuning jvm
Performance tuning jvmPerformance tuning jvm
Performance tuning jvm
 
Introduction to Real Time Java
Introduction to Real Time JavaIntroduction to Real Time Java
Introduction to Real Time Java
 
Java Performance Monitoring & Tuning
Java Performance Monitoring & TuningJava Performance Monitoring & Tuning
Java Performance Monitoring & Tuning
 

Similar to JMC/JFR: Kotlin spezial

ASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdfASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdfMiro Wengner
 
DevDays: Profiling With Java Flight Recorder
DevDays: Profiling With Java Flight RecorderDevDays: Profiling With Java Flight Recorder
DevDays: Profiling With Java Flight RecorderMiro 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
 
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
 
ログ出力を改めて考える - JDK Flight Recorder の活用
ログ出力を改めて考える - JDK Flight Recorder の活用ログ出力を改めて考える - JDK Flight Recorder の活用
ログ出力を改めて考える - JDK Flight Recorder の活用Yoshiro Tokumasu
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
OpenWebBeans and DeltaSpike at ApacheCon
OpenWebBeans and DeltaSpike at ApacheConOpenWebBeans and DeltaSpike at ApacheCon
OpenWebBeans and DeltaSpike at ApacheConos890
 
Batch Applications for the Java Platform
Batch Applications for the Java PlatformBatch Applications for the Java Platform
Batch Applications for the Java PlatformSivakumar Thyagarajan
 
Java gpu computing
Java gpu computingJava gpu computing
Java gpu computingArjan Lamers
 
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.pdfAna-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.pdfAna-Maria Mihalceanu
 
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 RuntimeNETWAYS
 
Jpf model checking
Jpf model checkingJpf model checking
Jpf model checkingthought444
 
Rapid JCR Applications Development with Sling
Rapid JCR Applications Development with SlingRapid JCR Applications Development with Sling
Rapid JCR Applications Development with SlingFelix Meschberger
 
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.pdfAna-Maria Mihalceanu
 

Similar to JMC/JFR: Kotlin spezial (20)

ASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdfASML_FlightRecorderMeetsJava.pdf
ASML_FlightRecorderMeetsJava.pdf
 
DevDays: Profiling With Java Flight Recorder
DevDays: Profiling With Java Flight RecorderDevDays: Profiling With Java Flight Recorder
DevDays: Profiling With Java Flight Recorder
 
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.
 
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]
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
ログ出力を改めて考える - JDK Flight Recorder の活用
ログ出力を改めて考える - JDK Flight Recorder の活用ログ出力を改めて考える - JDK Flight Recorder の活用
ログ出力を改めて考える - JDK Flight Recorder の活用
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Troubleshooting Tools In JDK
Troubleshooting Tools In JDKTroubleshooting Tools In JDK
Troubleshooting Tools In JDK
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
OpenWebBeans and DeltaSpike at ApacheCon
OpenWebBeans and DeltaSpike at ApacheConOpenWebBeans and DeltaSpike at ApacheCon
OpenWebBeans and DeltaSpike at ApacheCon
 
Curator intro
Curator introCurator intro
Curator intro
 
Java
Java Java
Java
 
Batch Applications for the Java Platform
Batch Applications for the Java PlatformBatch Applications for the Java Platform
Batch Applications for the Java Platform
 
Java gpu computing
Java gpu computingJava gpu computing
Java gpu computing
 
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
 
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
 
Jpf model checking
Jpf model checkingJpf model checking
Jpf model checking
 
Rapid JCR Applications Development with Sling
Rapid JCR Applications Development with SlingRapid JCR Applications Development with Sling
Rapid JCR Applications Development with Sling
 
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
 

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 engineeringMiro 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 JavaMiro 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 FrameworkMiro 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 APIMiro Wengner
 
How RaspberryPi workers building GraphDatabase
How RaspberryPi workers building GraphDatabaseHow RaspberryPi workers building GraphDatabase
How RaspberryPi workers building GraphDatabaseMiro 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

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

JMC/JFR: Kotlin spezial

  • 1. Miroslav Wengner JMC/JFR: Kotlin spezial Pro fi ling/Monitoring with joy
  • 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 • OpenJDK Committer , Java Mission Control Project • Co-Author of Robo4J Project (Duke Award) • Contributor to other open-source projects • Java Champion, JavaOne RockStar
  • 5. Agenda • Brief history • JFR in bullet points • JFR fundamentals / Under the hood • Performance (why overhead 1%) • DEMOS : Java “vs.” Kotlin • HotMethods, GC, Latencies and more… • Q/A
  • 6. Brief history : back in time • 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
  • 7. JFR in bullets • 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
  • 8. JFR Under the Hood Event life cycle Java Event API JVM Events Thread Local Buffers Events Global Bu ff ers Repository per 1s JFR Event Streaming (JEP 349): Continual Monitoring
  • 9. JFR: 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
  • 10. 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(); } …
  • 11. Event: Tuning up 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/16/docs/api/jdk.jfr/jdk/jfr/class-use/MetadataDe fi nition.html
  • 12. … import jdk.jfr.Categor y import jdk.jfr.Descriptio n import jdk.jfr.Even t import jdk.jfr.Labe l …. @Label("Latency-Worker-SampleKotlinEvent" ) @Category("Latency_Example" ) @Description("something is done" ) class SampleKotlinEvent() : Event( ) … Event: Tuning up Kotlin way
  • 13. JFR: Performance • Usage of Thread Local Bu ff ers • Java Platform Optimization • Methods: INLINING, CODE ELIMINATION, SCALARIZATION • What happens when event is enabled / disabled
  • 14. 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()
  • 15. 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: Enabled
  • 16. JFR: 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 } }
  • 17. JFR: 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 intrisince>; 4. CODE ELIMINATION => long startTime = <JVM intrisince>; REMOVAL //business logic }
  • 18. JFR: Disabled - part 3 void someAdvanceLogic() { //business logic }
  • 19. JFR: Data Visualistion • 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
  • 20. Java Mission Control Project Current release 8.1 • New Allocation Events for JDK 16 • JMC Agent, JMC Agent Plugin • Performance Improvements : Perser, Rules • Many others Release Milestone Date ========== =========== ========== 8.1.0 GA 2021-08-02 8.2.0 RDS 2021-11-24 8.2.0 RDS 2 2021-12-22 8.2.0 GA 2022-01-19
  • 21. DEMOS: Agenda • Pro fi ling equivalent solution in Java “vs.” Kotlin • examples: • Hot-Methods (SHOW TIME) • Garbage Collection (SHOW TIME) • Latency (SHOW TIME) • JMC Agent + JMC Agent Plugin https://developers.redhat.com/blog/2020/10/29/collect-jdk- fl ight-recorder-events-at-runtime-with-jmc-agent#introduction_to_the_jmc_agent_plugin
  • 25. DEMO: Latency - Agent • JMC-Agent v.1.0.0 for Java 11
  • 26. 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
  • 27. Q / A Thank YOU ! twitter: @miragemiko gitlab:@mirage22 DEMOS: https://github.com/mirage22/jmc-jvm-lang-tutorial