notes/pl/java/tools/quality/profiling/jfr/docs/presentations.txt
Ihar Hancharenka a3ca0e53ff m
2024-06-07 18:59:14 +03:00

77 строки
2.7 KiB
Plaintext

https://docs.oracle.com/en/java/javase/22/jfapi/why-use-jfr-api.html
https://inside.java/tag/jfr
2024
Java - Joakim Nordstrom - Programmer's Guide to JDK Flight Recorder 31:00 of 36:55
https://www.youtube.com/watch?v=AgFOJEkBVjg
! default conf is at lib/jfr/default.jfc, profile.jfc
! java -XX:StartFlightRecording # less than 1% overhead
! java -XX:StartFlightRecording:maxage=10m,maxsize=750M
! java -XX:StartFlightRecording:dumponexit=true,filename=/var/log/rec_%p_%t.jfr
! ... at runtime ...
! jcmd <pid> JFR.start
! jcmd <pid> JFR.dump
! jcmd <pid> JFR.stop
! jcmd <pid> JFR.check
! 20496:
! Recording 1: name=1 maxsize=250,0Mb (running)
! jfr summary <file>.jfr
! jfr view --verbose <file>.jfr
! jfr help view # 70 predefined views
@Name("inside.dumpster.ServiceCall")
@Label("Service.Call")
@Category({"Business Application", "Services"})
public class ServiceCallEvent extends jdk.jfr.Event {
@Label("Service Destination")
public String destination;
@Name("serviceClass")
@Label("Service Implementation Class")
public Class serviceImplClass;
}
Hello event = new Hello();
event.begin();
...
event.message = "Hello Event!";
...
event.commit();
! monitoring
Configuration conf = Configuration.getConfiguration("default");
try (var stream = new RecordingStream(conf)) {
stream.enable("jdk.CPULoad").withPeriod(Duration.ofSeconds(1));
stream.onEvent("jdk.CPULoad", event -> {
float cpuLoad = event.getFloat("jvmUser");
if (cpuLoad > 0.8) {
stream.dupm(dupmPath);
}
});
stream.start();
}
! instead of using a RecordingStream we can use RemoteRecordingStream
! ... stream.startAsync();
! stream.stop(); // new in JDK 20
https://github.com/moditect/jfrunit
import org.moditect.jfrunit.events.JfrEventTypes;
https://github.com/moditect/jfrunit-examples
https://github.com/moditect/jfr-analytics
some interesting field annotations
@DataAmount
@MemoryAddress
@Frequency
@Percentage
2023
Java - Continuous Monitoring with JDK Flight Recorder 0:00 of 45:55
https://www.youtube.com/watch?v=Gx_JGVborJ0
2022
Java - Programmer's Guide to JDK Flight Recorder of 24:08
https://www.youtube.com/watch?v=K1ApBZGiT-Y
2020
Vidstedt - Continuous Monitoring with JDK Flight Recorder
https://www.youtube.com/watch?v=plYESjZ12hM
Gronlund - JDK11 - Introduction to JDK Flight Recorder
https://www.youtube.com/watch?v=7z_R2Aq-Fl8
https://www.infoq.com/presentations/monitoring-jdk-jfr/