Java Performance Tuning
Java(TM) - see bottom of page
Our valued sponsors who help make this site possible
JProfiler: Get rid of your performance problems and memory leaks!
Training online: Concurrency, Threading, GC, Advanced Java and more ...
Tips August 2025
|
JProfiler
|
|
Get rid of your performance problems and memory leaks!
|
|
JProfiler
|
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 297 contents
https://blog.kelunik.com/2025/08/24/method-trace-java-25.html
Method Timing in Java 25 with JFR and OpenTelemetry (Page last updated August 2025, Added 2025-08-28, Author Niklas Keller, Publisher kelunik's blog). Tips:
- JEP 520, arriving with Java 25, introduces jdk.MethodTiming and jdk.MethodTrace events in the Java Flight Recorder (JFR). This can be used to export timing metrics via OpenTelemetry.
- jdk.MethodTiming provides aggregated metrics, with both invocation counts and averages cumulative.
- jdk.MethodTrace can be used with stack traces disabled allowing each method call to be directly recorded.
- Configure jdk.MethodTrace to filter on only the methods you are interested in tracing.
- This article provides an example of using jdk.MethodTrace to record method times for specific methods, without directly changing code, ie the JFR instrumentation instruments the code to achieve this.
https://egahlin.github.io/2025/05/31/whats-new-in-jdk-25.html
What's new for JFR in JDK 25 (Page last updated May 2025, Added 2025-08-28, Author Erik Gahlin, Publisher egahlin). Tips:
- The new cooperative sampling from JEP 518 gives more accurate and scalable method-level profiling.
- JEP 518 adds a new SafepointLatency JFR event which measures how long threads take to hit safepoints. Use eg `java -XX:StartFlightRecording:jdk.SafepointLatency#enabled=true,filename=r.jfr` and view with eg `jfr print --events jdk.SafepointLatency r.jfr`.
- JEP 509 adds jdk.CPUTimeSample event,which is CPU time profiling. Use eg `java -XX:StartFlightRecording:jdk.CPUTimeSample#enabled=true,filename=c.jfr` and view eg `jfr view cpu-time-hot-methods c.jfr`.
- JEP 520 adds two new new method-level events (jdk.MethodTiming, jdk.MethodTrace) to trace and time methods using instrumentation instead of sampling.
- JDK 25 supports rate-limited sampling of Java events by annotating your event with @throttle.
- JDK 25 comes with a new annotation to help tools visualize contextual information by annotating events with @contextual.
https://mostlynerdless.de/blog/2025/06/11/java-25s-new-cpu-time-profiler-1/
Java 25's new CPU-Time Profiler (Page last updated June 2025, Added 2025-08-28, Author Johannes Bechberger, Publisher mostlynerdless). Tips:
- Wall-clock sampling suffers from subsampling bias. On a 32-core machine, a 10 ms interval can be effectively stretched to 53 ms due to thread skipping and high parallelism. This degrades accuracy, particularly in high-concurrency environments.
- The new jdk.CPUTimeSample event leverages Linux's CPU-time signals (SIGPROF), capturing accurate CPU usage even inside native code.
- The new JFR jdk.CPUTimeSample profiler no longer differentiates between Java and native code.
- The profiler may emit too many events in high-thread-count environments, causing overhead or data loss. Configure the throttle setting, eg throttle=500/s.
- Watch the jdk.CPUTimeSampleLoss event to detect drop-offs in sampling fidelity.
- List the top 25 methods dominating CPU-time `jfr view cpu-time-hot-methods profile.jfr`.
Jack Shirazi
Back to newsletter 297 contents
Last Updated: 2025-12-25
Copyright © 2000-2025 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. JavaPerformanceTuning.com is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
URL: http://www.JavaPerformanceTuning.com/news/newtips297.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us