SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Downloaden Sie, um offline zu lesen
A Glance at
The Java Performance
Toolbox
Java Champion Alumni, Certified Architect
Senior Developer Advocate at Oracle
Passionate about solving complex scenarios involving
Java and Kubernetes.
ammbra1508 ammbra1508.mastondon.social
Developer Questions Using Java Applications
in Containers
• Which tools help you create container images with only what is needed at runtime?
• How to run the JDK tools in containers and proxy their output?
• Why and how to capture performance relevant JVM and application events?
• Which tools help you fine tune the JVM flags and keep application overhead at
minimum?
• How to correlate data from JVM monitoring tools with the one from tools like
Prometheus, Grafana?
Tools to build an OCI Compliant Image
• Docker build
• Buildpacks
• Jib
• kaniko
• buildah
• s2i
• And many more J
The Good Old Dockerfile
The Good Old Dockerfile
Use a small base image
The Good Old Dockerfile
Use a small base image
Create images with common layers
The Good Old Dockerfile
Use a small base image
Install only what is strictly needed
Create images with common layers
Creating Custom Java
Runtimes for Container
Images
Jlink
JEP 282 “Link time is an opportunity to do whole-world optimizations that are
otherwise difficult at compile time or costly at run-time”
jlink: Command Line Tool to Link Modules
• Modules in a jimage file
• Generate runtime images
Jlink Packaging
Legacy JDK image
JDK > 9 generated image
bin jre lib
bin conf ……..
Modular runtime image
jlink
Maintain The Good Old Dockerfile with JLink
The runtime stage build
• From a JDK base image
• Create your own custom JRE with jlink
Maintain The Good Old Dockerfile with JLink
The runtime stage build
• From a JDK base image
• Create your own custom JRE with jlink
The application stage build
• From an OS base image
• Copy the custom JRE from the runtime stage build
• Copy the artifacts needed by your application
• Run the application
The Runtime Stage Build
The Runtime Stage Build
The Runtime Stage Build
jdeps --ignore-missing-deps -q -recursive 
--multi-release 20 --print-module-deps 
--class-path 'target/libs/*’ 
target/spring-todo-app.jar
The Runtime Stage Build
The Runtime Stage Build
Strips debug information from the output image
The Runtime Stage Build
The Runtime Stage Build
Exclude man pages and header files
The Runtime Stage Build
z
The Runtime Stage Build
Enable compression of resources:
0: No compression
1: Constant string sharing
2: ZIP
The Application Stage Build
Copy the custom JRE
The Application Stage Build
Copy the artifacts needed by your application
The Application Stage Build
Run the application
Fine Tuning JVM Flags
Tracking Native Memory With Jcmd
Tracking Native Memory With Jcmd
Add jdk.jcmd module
Tracking Native Memory With Jcmd
WARNING: Overusing jcmd to send diagnostic commands can affect the performance of the VM.
Tracking Native Memory With Jcmd
WARNING: Overusing jcmd to send diagnostic commands can affect the performance of the VM.
Add -XX:NativeMemoryTracking={off|summary|detail} to JDK_JAVA_OPTIONS
• kubectl set env deployment/app JDK_JAVA_OPTIONS=“-XX:NativeMemoryTracking=summary”
• Please consider that having NMT enabled can add application performance overhead.
Tracking Native Memory With Jcmd
WARNING: Overusing jcmd to send diagnostic commands can affect the performance of the VM.
Add -XX:NativeMemoryTracking={off|summary|detail} to JDK_JAVA_OPTIONS
Create a native memory baseline
kubectl exec pod_name –it --/bin/bash -c "jcmd llvmid VM.native_memory baseline"
Tracking Native Memory With Jcmd
WARNING: Overusing jcmd to send diagnostic commands can affect the performance of the VM.
Add -XX:NativeMemoryTracking={off|summary|detail} to JDK_JAVA_OPTIONS
Create a native memory baseline
kubectl exec pod_name –it --/bin/bash -c "jcmd llvmid VM.native_memory baseline"
Create a native memory summary diff
kubectl exec pod_name –it --/bin/bash -c "jcmd llvmid VM.native_memory summary.diff"
Enabling JMX Monitoring and Remote Access
to a Remote Host
Conserving Dynamic Footprint by
Minimizing Java Heap Size
Start by looking at the JVM ergonomics
Conserving Dynamic Footprint by
Minimizing Java Heap Size
Start by looking at the JVM ergonomics
At initialization of the virtual machine, the entire space for the heap is reserved.
Eg: setting for minimum and maximum heap size: -Xms768m -Xmx768m
Conserving Dynamic Footprint by
Minimizing Java Heap Size
Start by looking at the JVM ergonomics
At initialization of the virtual machine, the entire space for the heap is reserved.
Eg: setting for minimum and maximum heap size: -Xms768m -Xmx768m
Minimize Java heap size by lowering the values of the options:
• -XX:MaxHeapFreeRatio (default value is 70%)
-XX:MinHeapFreeRatio (default value is 40%)
• Eg:-XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=70
Get Statistics About
Running Java Processes
Obtain Statistics with Jstat and Jmap
Obtain statistics about garbage collectors by running jstat
kubectl exec pod_name –it --/bin/bash -c "jstat -gcutil llvmid 250 10"
Obtain Statistics with Jstat and Jmap
Obtain statistics about garbage collectors by running jstat
kubectl exec pod_name –it --/bin/bash -c "jstat -gcutil llvmid 250 10"
Print heap summaries
kubectl exec pod_name –it --/bin/bash -c "jmap -histo llvmid"
Capture Performance
Relevant JVM And
Application Events
Add JFR To Your Container Image
Enable JFR
Enable JFR in JDK_JAVA_OPTIONS
kubectl set env deployment/app JDK_JAVA_OPTIONS=“--XX:StartFlightRecording:..”
Enable JFR
Enable JFR in JDK_JAVA_OPTIONS
kubectl set env deployment/app JDK_JAVA_OPTIONS=“--XX:StartFlightRecording:..”
Start a Time Fixed Recording with profile settings
-XX:StartFlightRecording=delay=10s,duration=10m,name=Profiling,settings=profile
Enable JFR
Enable JFR in JDK_JAVA_OPTIONS
kubectl set env deployment/app JDK_JAVA_OPTIONS=“--XX:StartFlightRecording:..”
Start a Time Fixed Recording with profile settings
-XX:StartFlightRecording=delay=10s,duration=10m,name=Profiling,settings=profile
Start a Time Fixed Recording with default settings
-XX:StartFlightRecording=delay=10s,duration=10m,name=Default,settings=default
Enable JFR
Enable JFR in JDK_JAVA_OPTIONS
kubectl set env deployment/app JDK_JAVA_OPTIONS=“--XX:StartFlightRecording:..”
Start a Time Fixed Recording with profile settings
-XX:StartFlightRecording=delay=10s,duration=10m,name=Profiling,settings=profile
Start a Time Fixed Recording with default settings
-XX:StartFlightRecording=delay=10s,duration=10m,name=Default,settings=default
Start a Continous Recording
-XX:StartFlightRecording:filename=/recordings/recording.jfr,settings=profile
Where to Use JFR Streaming
Streaming selected metrics to your monitoring service
Send an average, min, max, etc of a metric
Expose JFR data through other management APIs
Where NOT to Use JFR Streaming
“To consume the data today, a user must start a recording, stop it, dump the
contents to disk and then parse the recording file. This works well for
application profiling, where typically at least a minute of data is being
recorded at a time, but not for monitoring purposes.“
source: JEP 349
Make your settings by extending
jdk.jfr.SettingControl
Recording Custom
JFR Events
Make your settings by extending
jdk.jfr.SettingControl
Create your custom event by extending
jdk.jfr.Event
Recording Custom
JFR Events
Recording Custom
JFR Events
Make your settings by extending
jdk.jfr.SettingControl
Create your custom event by extending
jdk.jfr.Event
Register the custom settings in your custom
event via
@jdk.jfr.SettingsDefinition
Recording Custom Events in Spring Boot
(example)
Capture the custom JFR events in a dedicated filter and register it
Recording Custom Events in Spring Boot
(example)
Listen the custom JFR events and record their duration
Thank You!
https://github.com/ammbra/performance-glance
Useful Links
• Article https://www.javaadvent.com/2022/12/a-sneak-peek-at-the-java-performance-toolbox.html
• Tools https://docs.oracle.com/en/java/javase/20/docs/specs/man/index.html
• Troubleshoot Memory Leaks: https://docs.oracle.com/en/java/javase/20/troubleshoot/troubleshooting-memory-
leaks.html
• JFR Runtime guide : https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/about.htm#JFRUH170
• Innovative JFR use by @gunnarmorling: https://www.morling.dev/blog/finding-java-thread-leaks-with-jdk-flight-
recorder-and-bit-of-sql/
• Great intro by @BillyKorando https://www.youtube.com/watch?v=K1ApBZGiT-Y
• jlink https://dev.java/learn/jlink/
• Erik Gahlin’s health report app
• @gunnarmorling article on custom JDK Flight Recorder Events

Weitere ähnliche Inhalte

Was ist angesagt?

Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracingTracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracingYuri Shkuro
 
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedKernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedAnne Nicolas
 
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/StableSR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stablejuet-y
 
Getting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshopGetting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshopstefansayer
 
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedPerformance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedBrendan Gregg
 
Reconnaissance of Virtio: What’s new and how it’s all connected?
Reconnaissance of Virtio: What’s new and how it’s all connected?Reconnaissance of Virtio: What’s new and how it’s all connected?
Reconnaissance of Virtio: What’s new and how it’s all connected?Samsung Open Source Group
 
Profiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf ToolsProfiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf ToolsemBO_Conference
 
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)Esun Kim
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsDivye Kapoor
 
Yocto project and open embedded training
Yocto project and open embedded trainingYocto project and open embedded training
Yocto project and open embedded trainingH Ming
 
Networking in Java with NIO and Netty
Networking in Java with NIO and NettyNetworking in Java with NIO and Netty
Networking in Java with NIO and NettyConstantine Slisenka
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golangBo-Yi Wu
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixBrendan Gregg
 
Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!Ray Jenkins
 
IntelON 2021 Processor Benchmarking
IntelON 2021 Processor BenchmarkingIntelON 2021 Processor Benchmarking
IntelON 2021 Processor BenchmarkingBrendan Gregg
 

Was ist angesagt? (20)

Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracingTracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
Tracing 2000+ polyglot microservices at Uber with Jaeger and OpenTracing
 
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedKernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
 
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/StableSR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
 
Init of Android
Init of AndroidInit of Android
Init of Android
 
Getting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshopGetting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshop
 
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedPerformance Wins with BPF: Getting Started
Performance Wins with BPF: Getting Started
 
Reconnaissance of Virtio: What’s new and how it’s all connected?
Reconnaissance of Virtio: What’s new and how it’s all connected?Reconnaissance of Virtio: What’s new and how it’s all connected?
Reconnaissance of Virtio: What’s new and how it’s all connected?
 
Profiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf ToolsProfiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf Tools
 
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
Akka.NET 으로 만드는 온라인 게임 서버 (NDC2016)
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOs
 
Yocto project and open embedded training
Yocto project and open embedded trainingYocto project and open embedded training
Yocto project and open embedded training
 
Networking in Java with NIO and Netty
Networking in Java with NIO and NettyNetworking in Java with NIO and Netty
Networking in Java with NIO and Netty
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Dpdk performance
Dpdk performanceDpdk performance
Dpdk performance
 
Embedded Operating System - Linux
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - Linux
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at Netflix
 
Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!
 
IntelON 2021 Processor Benchmarking
IntelON 2021 Processor BenchmarkingIntelON 2021 Processor Benchmarking
IntelON 2021 Processor Benchmarking
 

Ähnlich wie A Glance At The Java Performance Toolbox-TIA.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.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
 
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
 
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
 
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 ToolboxAna-Maria Mihalceanu
 
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 ToolboxAna-Maria Mihalceanu
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
ContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdfContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdfSumanMitra22
 
ContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdfContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdfSumanMitra22
 
Java in a world of containers
Java in a world of containersJava in a world of containers
Java in a world of containersDocker, Inc.
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Arun Gupta
 
Java in a world of containers
Java in a world of containersJava in a world of containers
Java in a world of containersDocker, Inc.
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Arun Gupta
 
Master your java_applications_in_kubernetes
Master your java_applications_in_kubernetesMaster your java_applications_in_kubernetes
Master your java_applications_in_kubernetesAndy Moncsek
 
Master your java_applications_in_kubernetes
Master your java_applications_in_kubernetesMaster your java_applications_in_kubernetes
Master your java_applications_in_kubernetesAndy Moncsek
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeOmar Bashir
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeOmar Bashir
 

Ähnlich wie A Glance At The Java Performance Toolbox-TIA.pdf (20)

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
 
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
 
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
 
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
 
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
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA 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 ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
ContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdfContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdf
 
ContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdfContainerWorkloadwithSemeru.pdf
ContainerWorkloadwithSemeru.pdf
 
Java in a world of containers
Java in a world of containersJava in a world of containers
Java in a world of containers
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018
 
Java in a world of containers
Java in a world of containersJava in a world of containers
Java in a world of containers
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018
 
Master your java_applications_in_kubernetes
Master your java_applications_in_kubernetesMaster your java_applications_in_kubernetes
Master your java_applications_in_kubernetes
 
Master your java_applications_in_kubernetes
Master your java_applications_in_kubernetesMaster your java_applications_in_kubernetes
Master your java_applications_in_kubernetes
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and Runtime
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and Runtime
 

Mehr von Ana-Maria Mihalceanu

Surveillance de la sécurité des applications Java avec les outils du JDK e...
Surveillance de la sécurité des applications Java  avec les outils du JDK e...Surveillance de la sécurité des applications Java  avec les outils du JDK e...
Surveillance de la sécurité des applications Java avec les outils du JDK e...Ana-Maria Mihalceanu
 
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
 
Enhancing Productivity and Insight A Tour of JDK Tools Progress Beyond Java 17
Enhancing Productivity and Insight  A Tour of JDK Tools Progress Beyond Java 17Enhancing Productivity and Insight  A Tour of JDK Tools Progress Beyond Java 17
Enhancing Productivity and Insight A Tour of JDK Tools Progress Beyond Java 17Ana-Maria Mihalceanu
 
Java 21 Language Features and Beyond
Java 21 Language Features and BeyondJava 21 Language Features and Beyond
Java 21 Language Features and BeyondAna-Maria Mihalceanu
 
From Java 17 to 21- A Showcase of JDK Security Enhancements
From Java 17 to 21- A Showcase of JDK Security EnhancementsFrom Java 17 to 21- A Showcase of JDK Security Enhancements
From Java 17 to 21- A Showcase of JDK Security EnhancementsAna-Maria Mihalceanu
 
Java 21 and Beyond- A Roadmap of Innovations
Java 21 and Beyond- A Roadmap of InnovationsJava 21 and Beyond- A Roadmap of Innovations
Java 21 and Beyond- A Roadmap of InnovationsAna-Maria Mihalceanu
 
How Java 19 Influences the Future of Your High-Scale Applications .pdf
How Java 19 Influences the Future of Your High-Scale Applications .pdfHow Java 19 Influences the Future of Your High-Scale Applications .pdf
How Java 19 Influences the Future of Your High-Scale Applications .pdfAna-Maria Mihalceanu
 
The Automation Challenge Kubernetes Operators vs Helm Charts.pdf
The Automation Challenge Kubernetes Operators vs Helm Charts.pdfThe Automation Challenge Kubernetes Operators vs Helm Charts.pdf
The Automation Challenge Kubernetes Operators vs Helm Charts.pdfAna-Maria Mihalceanu
 
Cloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upCloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upAna-Maria Mihalceanu
 
Cloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upCloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upAna-Maria Mihalceanu
 
Cloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upCloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upAna-Maria Mihalceanu
 
The automation challenge Kubernetes operators vs Helm charts
The automation challenge Kubernetes operators vs Helm chartsThe automation challenge Kubernetes operators vs Helm charts
The automation challenge Kubernetes operators vs Helm chartsAna-Maria Mihalceanu
 
Cloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upCloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upAna-Maria Mihalceanu
 
DevoxxUK 2021 Techniques for maintainable Quarkus applications
DevoxxUK 2021 Techniques for maintainable Quarkus applicationsDevoxxUK 2021 Techniques for maintainable Quarkus applications
DevoxxUK 2021 Techniques for maintainable Quarkus applicationsAna-Maria Mihalceanu
 
The automation challenge: Kubernetes Operators vs Helm Charts
The automation challenge: Kubernetes Operators vs Helm ChartsThe automation challenge: Kubernetes Operators vs Helm Charts
The automation challenge: Kubernetes Operators vs Helm ChartsAna-Maria Mihalceanu
 
Techniques for maintainable Quarkus applications
Techniques for maintainable Quarkus applicationsTechniques for maintainable Quarkus applications
Techniques for maintainable Quarkus applicationsAna-Maria Mihalceanu
 
Techniques for maintainable Quarkus applications
Techniques for maintainable Quarkus applicationsTechniques for maintainable Quarkus applications
Techniques for maintainable Quarkus applicationsAna-Maria Mihalceanu
 
Five tips for performant microservices on quarkus
Five tips for performant microservices on quarkusFive tips for performant microservices on quarkus
Five tips for performant microservices on quarkusAna-Maria Mihalceanu
 
Tailor metrics-that-matter-with-quarkus
Tailor metrics-that-matter-with-quarkusTailor metrics-that-matter-with-quarkus
Tailor metrics-that-matter-with-quarkusAna-Maria Mihalceanu
 

Mehr von Ana-Maria Mihalceanu (20)

Surveillance de la sécurité des applications Java avec les outils du JDK e...
Surveillance de la sécurité des applications Java  avec les outils du JDK e...Surveillance de la sécurité des applications Java  avec les outils du JDK e...
Surveillance de la sécurité des applications Java avec les outils du JDK e...
 
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
 
Enhancing Productivity and Insight A Tour of JDK Tools Progress Beyond Java 17
Enhancing Productivity and Insight  A Tour of JDK Tools Progress Beyond Java 17Enhancing Productivity and Insight  A Tour of JDK Tools Progress Beyond Java 17
Enhancing Productivity and Insight A Tour of JDK Tools Progress Beyond Java 17
 
Java 21 Language Features and Beyond
Java 21 Language Features and BeyondJava 21 Language Features and Beyond
Java 21 Language Features and Beyond
 
From Java 17 to 21- A Showcase of JDK Security Enhancements
From Java 17 to 21- A Showcase of JDK Security EnhancementsFrom Java 17 to 21- A Showcase of JDK Security Enhancements
From Java 17 to 21- A Showcase of JDK Security Enhancements
 
Java 21 and Beyond- A Roadmap of Innovations
Java 21 and Beyond- A Roadmap of InnovationsJava 21 and Beyond- A Roadmap of Innovations
Java 21 and Beyond- A Roadmap of Innovations
 
How Java 19 Influences the Future of Your High-Scale Applications .pdf
How Java 19 Influences the Future of Your High-Scale Applications .pdfHow Java 19 Influences the Future of Your High-Scale Applications .pdf
How Java 19 Influences the Future of Your High-Scale Applications .pdf
 
The Automation Challenge Kubernetes Operators vs Helm Charts.pdf
The Automation Challenge Kubernetes Operators vs Helm Charts.pdfThe Automation Challenge Kubernetes Operators vs Helm Charts.pdf
The Automation Challenge Kubernetes Operators vs Helm Charts.pdf
 
Exploring Quarkus on JDK 17
Exploring Quarkus on JDK 17Exploring Quarkus on JDK 17
Exploring Quarkus on JDK 17
 
Cloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upCloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground up
 
Cloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upCloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground up
 
Cloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upCloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground up
 
The automation challenge Kubernetes operators vs Helm charts
The automation challenge Kubernetes operators vs Helm chartsThe automation challenge Kubernetes operators vs Helm charts
The automation challenge Kubernetes operators vs Helm charts
 
Cloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground upCloud native resiliency patterns from the ground up
Cloud native resiliency patterns from the ground up
 
DevoxxUK 2021 Techniques for maintainable Quarkus applications
DevoxxUK 2021 Techniques for maintainable Quarkus applicationsDevoxxUK 2021 Techniques for maintainable Quarkus applications
DevoxxUK 2021 Techniques for maintainable Quarkus applications
 
The automation challenge: Kubernetes Operators vs Helm Charts
The automation challenge: Kubernetes Operators vs Helm ChartsThe automation challenge: Kubernetes Operators vs Helm Charts
The automation challenge: Kubernetes Operators vs Helm Charts
 
Techniques for maintainable Quarkus applications
Techniques for maintainable Quarkus applicationsTechniques for maintainable Quarkus applications
Techniques for maintainable Quarkus applications
 
Techniques for maintainable Quarkus applications
Techniques for maintainable Quarkus applicationsTechniques for maintainable Quarkus applications
Techniques for maintainable Quarkus applications
 
Five tips for performant microservices on quarkus
Five tips for performant microservices on quarkusFive tips for performant microservices on quarkus
Five tips for performant microservices on quarkus
 
Tailor metrics-that-matter-with-quarkus
Tailor metrics-that-matter-with-quarkusTailor metrics-that-matter-with-quarkus
Tailor metrics-that-matter-with-quarkus
 

Kürzlich hochgeladen

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Kürzlich hochgeladen (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

A Glance At The Java Performance Toolbox-TIA.pdf

  • 1. A Glance at The Java Performance Toolbox
  • 2. Java Champion Alumni, Certified Architect Senior Developer Advocate at Oracle Passionate about solving complex scenarios involving Java and Kubernetes. ammbra1508 ammbra1508.mastondon.social
  • 3. Developer Questions Using Java Applications in Containers • Which tools help you create container images with only what is needed at runtime? • How to run the JDK tools in containers and proxy their output? • Why and how to capture performance relevant JVM and application events? • Which tools help you fine tune the JVM flags and keep application overhead at minimum? • How to correlate data from JVM monitoring tools with the one from tools like Prometheus, Grafana?
  • 4. Tools to build an OCI Compliant Image • Docker build • Buildpacks • Jib • kaniko • buildah • s2i • And many more J
  • 5. The Good Old Dockerfile
  • 6. The Good Old Dockerfile Use a small base image
  • 7. The Good Old Dockerfile Use a small base image Create images with common layers
  • 8. The Good Old Dockerfile Use a small base image Install only what is strictly needed Create images with common layers
  • 9. Creating Custom Java Runtimes for Container Images
  • 10. Jlink JEP 282 “Link time is an opportunity to do whole-world optimizations that are otherwise difficult at compile time or costly at run-time” jlink: Command Line Tool to Link Modules • Modules in a jimage file • Generate runtime images
  • 11. Jlink Packaging Legacy JDK image JDK > 9 generated image bin jre lib bin conf …….. Modular runtime image jlink
  • 12. Maintain The Good Old Dockerfile with JLink The runtime stage build • From a JDK base image • Create your own custom JRE with jlink
  • 13. Maintain The Good Old Dockerfile with JLink The runtime stage build • From a JDK base image • Create your own custom JRE with jlink The application stage build • From an OS base image • Copy the custom JRE from the runtime stage build • Copy the artifacts needed by your application • Run the application
  • 16. The Runtime Stage Build jdeps --ignore-missing-deps -q -recursive --multi-release 20 --print-module-deps --class-path 'target/libs/*’ target/spring-todo-app.jar
  • 18. The Runtime Stage Build Strips debug information from the output image
  • 20. The Runtime Stage Build Exclude man pages and header files
  • 21. The Runtime Stage Build z
  • 22. The Runtime Stage Build Enable compression of resources: 0: No compression 1: Constant string sharing 2: ZIP
  • 23. The Application Stage Build Copy the custom JRE
  • 24. The Application Stage Build Copy the artifacts needed by your application
  • 25. The Application Stage Build Run the application
  • 28. Tracking Native Memory With Jcmd Add jdk.jcmd module
  • 29. Tracking Native Memory With Jcmd WARNING: Overusing jcmd to send diagnostic commands can affect the performance of the VM.
  • 30. Tracking Native Memory With Jcmd WARNING: Overusing jcmd to send diagnostic commands can affect the performance of the VM. Add -XX:NativeMemoryTracking={off|summary|detail} to JDK_JAVA_OPTIONS • kubectl set env deployment/app JDK_JAVA_OPTIONS=“-XX:NativeMemoryTracking=summary” • Please consider that having NMT enabled can add application performance overhead.
  • 31. Tracking Native Memory With Jcmd WARNING: Overusing jcmd to send diagnostic commands can affect the performance of the VM. Add -XX:NativeMemoryTracking={off|summary|detail} to JDK_JAVA_OPTIONS Create a native memory baseline kubectl exec pod_name –it --/bin/bash -c "jcmd llvmid VM.native_memory baseline"
  • 32. Tracking Native Memory With Jcmd WARNING: Overusing jcmd to send diagnostic commands can affect the performance of the VM. Add -XX:NativeMemoryTracking={off|summary|detail} to JDK_JAVA_OPTIONS Create a native memory baseline kubectl exec pod_name –it --/bin/bash -c "jcmd llvmid VM.native_memory baseline" Create a native memory summary diff kubectl exec pod_name –it --/bin/bash -c "jcmd llvmid VM.native_memory summary.diff"
  • 33. Enabling JMX Monitoring and Remote Access to a Remote Host
  • 34. Conserving Dynamic Footprint by Minimizing Java Heap Size Start by looking at the JVM ergonomics
  • 35. Conserving Dynamic Footprint by Minimizing Java Heap Size Start by looking at the JVM ergonomics At initialization of the virtual machine, the entire space for the heap is reserved. Eg: setting for minimum and maximum heap size: -Xms768m -Xmx768m
  • 36. Conserving Dynamic Footprint by Minimizing Java Heap Size Start by looking at the JVM ergonomics At initialization of the virtual machine, the entire space for the heap is reserved. Eg: setting for minimum and maximum heap size: -Xms768m -Xmx768m Minimize Java heap size by lowering the values of the options: • -XX:MaxHeapFreeRatio (default value is 70%) -XX:MinHeapFreeRatio (default value is 40%) • Eg:-XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=70
  • 38. Obtain Statistics with Jstat and Jmap Obtain statistics about garbage collectors by running jstat kubectl exec pod_name –it --/bin/bash -c "jstat -gcutil llvmid 250 10"
  • 39. Obtain Statistics with Jstat and Jmap Obtain statistics about garbage collectors by running jstat kubectl exec pod_name –it --/bin/bash -c "jstat -gcutil llvmid 250 10" Print heap summaries kubectl exec pod_name –it --/bin/bash -c "jmap -histo llvmid"
  • 40. Capture Performance Relevant JVM And Application Events
  • 41. Add JFR To Your Container Image
  • 42. Enable JFR Enable JFR in JDK_JAVA_OPTIONS kubectl set env deployment/app JDK_JAVA_OPTIONS=“--XX:StartFlightRecording:..”
  • 43. Enable JFR Enable JFR in JDK_JAVA_OPTIONS kubectl set env deployment/app JDK_JAVA_OPTIONS=“--XX:StartFlightRecording:..” Start a Time Fixed Recording with profile settings -XX:StartFlightRecording=delay=10s,duration=10m,name=Profiling,settings=profile
  • 44. Enable JFR Enable JFR in JDK_JAVA_OPTIONS kubectl set env deployment/app JDK_JAVA_OPTIONS=“--XX:StartFlightRecording:..” Start a Time Fixed Recording with profile settings -XX:StartFlightRecording=delay=10s,duration=10m,name=Profiling,settings=profile Start a Time Fixed Recording with default settings -XX:StartFlightRecording=delay=10s,duration=10m,name=Default,settings=default
  • 45. Enable JFR Enable JFR in JDK_JAVA_OPTIONS kubectl set env deployment/app JDK_JAVA_OPTIONS=“--XX:StartFlightRecording:..” Start a Time Fixed Recording with profile settings -XX:StartFlightRecording=delay=10s,duration=10m,name=Profiling,settings=profile Start a Time Fixed Recording with default settings -XX:StartFlightRecording=delay=10s,duration=10m,name=Default,settings=default Start a Continous Recording -XX:StartFlightRecording:filename=/recordings/recording.jfr,settings=profile
  • 46. Where to Use JFR Streaming Streaming selected metrics to your monitoring service Send an average, min, max, etc of a metric Expose JFR data through other management APIs
  • 47. Where NOT to Use JFR Streaming “To consume the data today, a user must start a recording, stop it, dump the contents to disk and then parse the recording file. This works well for application profiling, where typically at least a minute of data is being recorded at a time, but not for monitoring purposes.“ source: JEP 349
  • 48. Make your settings by extending jdk.jfr.SettingControl Recording Custom JFR Events
  • 49. Make your settings by extending jdk.jfr.SettingControl Create your custom event by extending jdk.jfr.Event Recording Custom JFR Events
  • 50. Recording Custom JFR Events Make your settings by extending jdk.jfr.SettingControl Create your custom event by extending jdk.jfr.Event Register the custom settings in your custom event via @jdk.jfr.SettingsDefinition
  • 51. Recording Custom Events in Spring Boot (example) Capture the custom JFR events in a dedicated filter and register it
  • 52. Recording Custom Events in Spring Boot (example) Listen the custom JFR events and record their duration
  • 54. Useful Links • Article https://www.javaadvent.com/2022/12/a-sneak-peek-at-the-java-performance-toolbox.html • Tools https://docs.oracle.com/en/java/javase/20/docs/specs/man/index.html • Troubleshoot Memory Leaks: https://docs.oracle.com/en/java/javase/20/troubleshoot/troubleshooting-memory- leaks.html • JFR Runtime guide : https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/about.htm#JFRUH170 • Innovative JFR use by @gunnarmorling: https://www.morling.dev/blog/finding-java-thread-leaks-with-jdk-flight- recorder-and-bit-of-sql/ • Great intro by @BillyKorando https://www.youtube.com/watch?v=K1ApBZGiT-Y • jlink https://dev.java/learn/jlink/ • Erik Gahlin’s health report app • @gunnarmorling article on custom JDK Flight Recorder Events