Question
How to get a rolling recording into disk, with a maximum age?
Context
When something goes bad in my server, I want to be able to dump the profiling information of the hours prior and analyse it, to know what went wrong.
- As I don't know when things will go bad, the JDK should be continuously saving the events to disk.
- As the server is not rebooted often, to avoid the files growing unbounded, I need to set some sort of cap (either age, or size).
So, in other words, I wanted the JDK to save the recordings continuously to disk, but remove the older files/recordings such that the total amount remains under a certain threshold (age or size).
To that end, these are the options I have for version Oracle JDK 1.8.0_144
:
-XX:+UnlockCommercialFeatures
-XX:+FlightRecorder
-XX:StartFlightRecording
name=<foo-bar>
-XX:FlightRecorderOptions
defaultrecording=true // what does this do even?
disk=true
maxage=1h // this is what I thought would solve my problem!
repository=<path-to-where-I-want-the-recording>
maxchunksize=5M
I would have thought that setting maxage=1h
would only keep the last 1 hour of recording on disk. But no! Its been past 1 day, and the files are not being capped.
At the same time the maxchunksize
appears to work. The various .jfr
files have approximately 5M. Of which there are many such files, since the the age capped is not being enforced.
What am I doing wrong?
// what does this do even?
don't exactly bring out the best of my customer support qualities out. – Barhamdefaultrecording
. Have you? – Dehlia