5 Replies Latest reply: Feb 14, 2014 6:48 AM by Erik (JRockit Engineering) RSS

    Help with maxage / limiting default recording disk usage

    ctoomey

      I've got 2 related questions:

       

      1) Is it possible using -XX:StartFlightRecording and/or XX:FlightRecorderOptions to cause flight recording to only keep the last N minutes worth of recorded data on disk, so that any any point one can view data on the last N minutes worth of activity?  How?

       

      2) What is the maxage parameter supposed to effect?  Reading http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/java.html it seems like it's supposed to do the above, but I've not been able to see any difference in behavior with any of these args, and in particular, each of them is continuing to fill up the /tmp dir. with .jfc files well past the maxage limit.

       

      No maxage: -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=false,dumponexit=true,dumponexitpath=/tmp,loglevel=trace

       

      Maxage on StartFlightRecording: -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=maxage=1m -XX:FlightRecorderOptions=defaultrecording=false,dumponexit=true,dumponexitpath=/tmp,loglevel=trace

       

      Maxage on FlightRecorderOptions: -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=false,dumponexit=true,dumponexitpath=/tmp,loglevel=trace,maxage=1m

       

      thx,

      Chris

        • 1. Re: Help with maxage / limiting default recording disk usage
          Erik (JRockit Engineering)

          1) Yes, using the maxage parameter. But it only works if disk=true, if you have a disk repository, If you don't specify maxage/maxsize, and only set disk=true, the JVM will set up default values, if you use defaultrecording=true. If you want infinite, set maxsize=0,maxage=0 to overide the defaults.

           

          2) The maxage/maxsize parameters are thresholds at which the JVM will start to remove recording chunks from the disk repository. Since it would be to expensive to check thresholds at every event written, the thresholds are only checked when a new recording chunk is created, which happens about every 12-15 Mb  (depending on how much data exist in thread buffers when they are flushed)  So with a  short maxage, like 1 minute, there may not have been enough data to trigger removal of chunks.

          • 2. Re: Help with maxage / limiting default recording disk usage
            ctoomey

            Thanks Erik, adding disk=true did the trick.

             

            I've found that the documentation and functionality of the -XX:StartFlightRecording and -XX:FlightRecorderOptions is very unclear and confusing.  Can you or others comment/clarify the following?


            • Is it correct that the XX:StartFlightRecording options are meant to only apply to a special start recording (that starts at server start time), while the XX:FlightRecorderOptions are meant to apply to any/all recordings?
            • Why are some of the XX:FlightRecorderOptions not also available for XX:StartFlightRecording, e.g., disk=true, dumponexit=true?  This makes it tricky to configure the start recording as you need to specify different options with different XX: parameters.
            • The settings=path option seems to have no effect when given to XX:FlightRecorderOptions, even though it's listed in the documentation page above as being a supported option.  When I use settings=path with XX:FlightRecorderOptions, I still get the default settings.  Is this a known implementation or documentation bug?
            • With both XX:StartFlightRecording and XX:FlightRecorderOptions, what's the behavior when defaultrecording=false?  The documentation says "Specifies whether the recording is a continuous background recording or it runs for a limited time. By default, this parameter is set to false (recording runs for a limited time)."  What is this limited time (how long)?  And is it a limited time forward from the beginning, or backwards from the current time?  Why is this setting even needed given the maxage, maxsize, and duration settings?

             

            thanks,

            Chris

            • 3. Re: Help with maxage / limiting default recording disk usage
              Erik (JRockit Engineering)

              "Is it correct that the XX:StartFlightRecording options are meant to only apply to a special start recording (that starts at server start time), while the XX:FlightRecorderOptions are meant to apply to any/all recordings"


              -XX:FlightRecorderOptions is meant to configure global settings, but there are also options that controls the default in-memory recording (called "Hotspot default"), which can be turned on by setting defaultrecording=true. Since Flight Recorder records the union of all ongoing recordings, it will in practise apply to other recordings as well.

               

              "The settings=path option seems to have no effect when given to XX:FlightRecorderOptions, even though it's listed in the documentation page above as being a supported option.  When I use settings=path with XX:FlightRecorderOptions, I still get the default settings.  Is this a known implementation or documentation bug?"


              It's a known bug, as a workaround you can replace the file named default.jfc in JRE_HOME/lib/jfr with the settings file you want, i.e profile.jfc

               

              "With both XX:StartFlightRecording and XX:FlightRecorderOptions, what's the behavior when defaultrecording=false?  "


              No default (in-memory) recording will be started

               

              "The documentation says "Specifies whether the recording is a continuous background recording or it runs for a limited time. By default, this parameter is set to false (recording runs for a limited time)." What is this limited time (how long)?  And is it a limited time forward from the beginning, or backwards from the current time?  Why is this setting even needed given the maxage, maxsize, and duration settings?"


              It's incorrect, defaultrecording=true is just a convenience option for starting the default in-memory recording. There is no limit put in place if you set it to false.

               

              If you want to use a disk repository, you can ignore all options that includes the word "default" and just use -XX:StartFlightRecording.

              • 4. Re: Help with maxage / limiting default recording disk usage
                ctoomey

                Thanks Erik.

                If you want to use a disk repository, you can ignore all options that includes the word "default" and just use -XX:StartFlightRecording.

                I found that even when I use -XX:StartFlightRecording, I can only get that recording dumped to disk on exit if I set defaultrecording=true along with disk=true,dumponexit=true,dumponexitpath=path via -XX:FlightRecorderOptions .

                 

                Chris

                • 5. Re: Help with maxage / limiting default recording disk usage
                  Erik (JRockit Engineering)

                  ctoomey wrote:

                   

                  Thanks Erik.

                  If you want to use a disk repository, you can ignore all options that includes the word "default" and just use -XX:StartFlightRecording.

                  I found that even when I use -XX:StartFlightRecording, I can only get that recording dumped to disk on exit if I set defaultrecording=true along with disk=true,dumponexit=true,dumponexitpath=path via -XX:FlightRecorderOptions .

                   

                  Chris

                   

                  You should be able dump the buffers on exit, even if you haven't started a defaultrecording.

                   

                  I will file a bug report. Thanks for reporting.