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 2018
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 213 contents
http://www.rationaljava.com/2015/01/java-flight-recorder-jfr.html
Java Flight Recorder (JFR) (Page last updated January 2015, Added 2018-08-27, Author Daniel Shaya, Publisher Rational Java). Tips:
- Profiling is approximate, it is often worth looking at more than one profiler to build up a clearer picture of what exactly is going on in your program.
- Most sampling profilers use safe point probing - only able to sample a thread when it hits a safe point. This can miss issues; JFR is one of the profilers that is not limited to safe point sampling.
- JFR has a UI available from Java Mission Control
https://smarttechie.org/2018/07/24/java-11-features-java-flight-recorder/
Java 11 Features - Java Flight Recorder (Page last updated July 2018, Added 2018-08-27, Author Siva Prasad Rao Janapati, Publisher smarttechie). Tips:
- Enabling JFR puts only a small overhead on the JVM
- Creating a time bounded JFR recording: java -XX:StartFlightRecording=delay=20s,duration=60s,filename=C:\myRecording.jfr,settings=profile,name=SampleRecording ...
- Crea ting a JFR recording on demand of the full run: java -XX:StartFlightRecording=settings=default ...
- Creating a JFR recording on exit of the full run: java -XX:StartFlightRecording=settings=default -XX:FlightRecorderOptions=dumponexit=true,dumponexitpath=C:\tmp ...
https://www.youtube.com/watch?v=EOeNugl0NlU
Using Java Flight Recorder (Page last updated January 2016, Added 2018-08-27, Author Marcus Hirt, Publisher Parleys). Tips:
- The data is already being gathered by the JVM so Flight Recorder only records it, rather than impose additional collecting overhead. Continuous recording is less than 1% overhead; if profiling is turned on it is (normally) less than 2%.
- Continuous Flight Recorder recordings must be explicitly dumped; Time fixed recordings are automatically dumped. If recordings overlap, each will include at least the data relevant to that recording, and likely some more.
- Creating a time bounded JFR recording: java -XX:StartFlightRecording=delay=20s,duration=60s,filename=C:\Temp\myrecording.jfr,settings=profile,name=MyRecording ...
- -XX:FlightRecorderOptions=loglevel=info to change the log level
- There are 2 JFR settings, settings=default and settings=profile
- -XX:FlightRecorderOptions=defaultrecording=true for dumping on exit dumponexit=true,dumponexitpath=C:\...
- jcmd supports JFR: jcmd PID JFR.start name=MyRecording settings=profile delay=20s duration=2m filename=C:\Temp\myrecording.jfr; jcmd PID JFR.check; jcmd PID JFR.dump name=MyRecording filename=C:\TEMP\dump.jfr
- Thresholds define which events to record, so you might not be recording some events, keep that in mind when analyzing, absence of events can be from thresholds rather than not having occurred.
- Account for CPU load when analyzing JFR method profiles - if there is not much CPU load, the method profiles will be from less data. If fully loaded CPU, the absolute latencies can be misleading - look instead at the relative but note native calls are not recorded.
- JFR uses the async sampling JVMTI so is not limited to sampling at safepoints.
- JFR can hold only the recent data in-memory for dumping, or can write to disk.
- There is no heap instance information recorded so no application sensitive data is recorded unless these are in stack traces or exception messages.
Jack Shirazi
Back to newsletter 213 contents
Last Updated: 2024-11-29
Copyright © 2000-2024 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/newtips213.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us