I have a Java process and I start it (as suggested here : parameters for FR) with the options :
-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=2m,filename=myflightrecord.jfr -XX:FlightRecorderOptions=maxsize=100k,maxage=1m
in order to have Flight Recorder information.
I would expect that the maxage=1m would give me only one minute of record, and maxsize=100k the file size wouldnt be larger than 100Kb, but none of them does work as expected.
Another problem that I encounter is that I want the file to be stored every amount of time, lets suppose every one minute. But the file "myflightrecord.jfr" is empty until the duration is reached (2minutes in the example).
Is there any way to make the Flight recorder flush before the end of the duration?
ps: The version of Java I am using is JDK1.8.0_45
The maxage and maxsize options only apply when you have a continuous recording (= have not set duration). I also think that they are only guidelines, not exact limits.
If you want to get the data flushed to disk for a continuous recording, you can set disk=true, and if you want to specify where the data should end up, you can set repository=path (I believe the data will only be flushed to disk when the the in memory buffers are full, I'm not sure if it's when the thread local buffers are full, or when the global buffers are full, see slide 13 in this slidedeck for a picture describing this: http://www.slideshare.net/marcushirt/java-mission-control-java-flight-recorder-deep-dive)
See https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html XX:FlightRecorderOptions for more info. You can check the threadbuffersize and globalbuffersize as well.
I know the valid combinations of flags have varied a bit, so the documentation might not be entirely up to date.
Kire Haglin can correct me where I've misunderstood things.