Troubleshooting, Monitoring and Profiling with Java Flight Recorder, Mission Control and Cryostat

jeremy_davis 38 views 24 slides Sep 26, 2024
Slide 1
Slide 1 of 24
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24

About This Presentation

Slides from JConfdev 2024
Java Flight Recorder and JDK Mission Control enable continuous collection of low level, detailed runtime information for incident analysis. JFR is included with the JDK, has a tiny footprint, and Java Flight Recorder is a profiling and event collection framework built into ...


Slide Content

Update confidential designator here
Version number here V00000
1
JDK Flight Recorder
and Cryostat

Update confidential designator here
Version number here V00000
Me
2
Jeremy Davis
Chief Architect, Red Hat
[email protected]

@argntprgrmr
(Threads, Instagram, x, Twitter, Bluesky)
@[email protected] (Mastodon)

Update confidential designator here
Version number here V00000
3
JDK Flight Recorder
and Cryostat

Jeremy Davis
Chief Architect, Red Hat
[email protected]
@argntprgrmr (Threads, Instagram, x, Twitter)
@[email protected]

Update confidential designator here
Version number here V00000
The TQM Guy
4
“Without data you are just
another person with an
opinion”
W. Edwards Deming

Update confidential designator here
Version number here V00000
It’s old
5

Update confidential designator here
Version number here V00000
We’re not in JRockit anymore!
6
JDK Flight Recorder

Update confidential designator here
Version number here V00000
Really 3 Things
7
Source:
Insert source data here
Insert source data here
▸JFR (JDK Flight Recorder)
▸jcmd
▸JMC (Java Mission Control)
Toolkit

Update confidential designator here
Version number here V00000
8
It’s Been Around a Long Time
Background
▸BEA JRockit Flight Recorder
▸Oracle JRockit
▸2018 OpenSource

Update confidential designator here
Version number here V00000
9
Deets
Details
▸Event Based
▸Events aggregated as “recordings”
▸API’s for producing and analyzing events and
event data
▸CLI, GUI, or custom
▸Designed for production

Update confidential designator here
Version number here V00000
10
Seriously!
Designed for Production
▸Designed for production
▸JVM Event (occur anyway)
▸Events saved into thread local buffers
▸Copied to global buffers
▸Written to disk or overwritten

Update confidential designator here
Version number here V00000
11
Real numbers
Production
▸Continuous capture works for occasional bugs
▸Terabytes of JFR data per minute
▸5 MiB per minute (2 MiB compressed)
▸< 2% overhead

Update confidential designator here
Version number here V00000
12
Events Are Core
Events
▸Event Id
▸Timestamp (CPU ticks)
▸Duration (CPU ticks)
▸Thread Id
▸Stack Trace Id
▸Event Specific Payload

Update confidential designator here
Version number here V00000
13
How to
Recording
▸java -XX:StartFlightRecording
▸java -XX:StartFlightRecording:filename=myrecording.jfr,dumponexit=true
▸jcmd 60128 JFR.start
▸jcmd 60128 JFR.dump name=1 filename=60128.jfr

Update confidential designator here
Version number here V00000
Java Mission Control

Making Sense
14

Update confidential designator here
Version number here V00000
cryostat.io
15
Cryostat

Update confidential designator here
Version number here V00000
16
cryostat.io
Cryostat UI
▸Dashboard
▸Automated Analysis
▸Grafana
▸Automated Rules
▸Recordings
▸Archive

Update confidential designator here
Version number here V00000
17
Recordings

Update confidential designator here
Version number here V00000
18
Automated Reports

Update confidential designator here
Version number here V00000
19
Event Types

Update confidential designator here
Version number here V00000
20
Event Templates

Update confidential designator here
Version number here V00000
Grafana
Who doesn’t love a good dashboard?
21

Update confidential designator here
Version number here V00000
Finally
22
You Can Leave It Running
< 1% overhead
Make Custom Events!
Kubernetes == Cryostat
All the goodness in k8s

Update confidential designator here
Version number here V00000
It won’t work (on a Mac) without this!
23

<array>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
<string>-vm</string>
<string>/Users/jeremyrdavis/.sdkman/candidates/java/current/bin/java</string>
</array>

/Applications/JDK\ Mission\ Control.app/Contents/Info.plist

Update confidential designator here
Version number here V00000
Links
Agenda
24
▸https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/toc.htm
▸https://cryostat.io
▸https://www.youtube.com/watch?v=XEKkUpPnf4Q
▸https://github.com/theygreystone/jmc-tutorial
▸https://developers.redhat.com/blog/2020/08/25/get-started-with-jdk-flight-recorder-in-openjdk-8u
▸https://www.youtube.com/watch?v=oPCTkW7S7T4
▸https://inside.java/2021/02/22/podcast-013/